Hello,<br><br>I&#39;m having some trouble getting lxml (v. 2.2) to validate an ElementTree<br>object that I&#39;m building and was hoping someone on the list could help and<br>maybe tell me what I&#39;m doing wrong.<br><br>
If I create an ElementTree object directly from xml and an associated schema,<br>it will validate fine.  If I then construct a similar ElementTree object by<br>just instantianting ElementTree, it will not validate.  The odd thing is<br>
that the resulting xml from etree.tostring for both objects is identical.<br><br>I&#39;ve attached a python script that shows the problem I&#39;m having.  The <br>validation error is:<br>*** DocumentInvalid: Element &#39;Foo&#39;: No matching global declaration available<br>
for the validation root.<br><br>I can get the second ElementTree object (etree2) to validate if I put the long<br>explicit namesplace in front of the tag value (Foo) when I create etree2 in the<br>script.  So, if I change line 25 in the script to:<br>
rootelem = etree.Element(&#39;{<a href="http://example.com">http://example.com</a>}Foo&#39;, {}, nsmap)<br>, it will validate.<br><br>However, the 2 resulting xml outputs are no longer equal b/c the output from <br>etree2 is output with explict namespaces.<br>
<br>Any ideas?  Thanks for any help.<br><br>-- James Slagle<br>