<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><style>p {margin:0px;padding:0px;} blockquote { border: 0px; margin-top: 0px; margin-bottom: 0px; }</style></head><body style="">
Hi,<br><font color="#000000" face="Verdana" size="2"><br><blockquote type="cite">Secondly, lxml 2.0 does not load referenced network resources by default.<br>While it loads documents that you explicitly ask it to download by parsing<br>from a URL, you will also have to explicitly tell it to enable network access<br>for referenced resources like DTDs, schemas and the like, again, by<br>configuring a parser.<br></blockquote></font><p>&nbsp;</p><p>A question on this:</p><p>I don't see any problems when network-parsing a schema that includes other schemas:</p><p>&nbsp;</p><p>&gt;&gt;&gt; schema = etree.XMLSchema(root)<br>&gt;&gt;&gt; print etree.__version__<br>2.0.0-51192<br>&gt;&gt;&gt; root = objectify.parse("http://adevp02:8080/accountSummary-1.2.xsd").getroot()<br>&gt;&gt;&gt; schema = etree.XMLSchema(root)<br>&gt;&gt;&gt;</p><p>&nbsp;</p><p>My simple http server says this:</p><p>&nbsp;</p><p>adevp01.ae.hz.lbbw.sko.de - - [12/Feb/2008 08:49:19] "GET /accountSummary-1.2.xsd HTTP/1.0" 200 -</p><p>adevp01.ae.hz.lbbw.sko.de - - [12/Feb/2008 08:49:28] "GET /iso3currency.xsd HTTP/1.0" 200 -<br>adevp01.ae.hz.lbbw.sko.de - - [12/Feb/2008 08:49:28] "GET /iso3currency-1.0.xsd HTTP/1.0" 200 - </p><p>&nbsp;</p><p>where the first GET is the parse operation and the 2nd &amp; 3rd GET are the "schemafying" of the</p><p>parsed doc.</p><p>&nbsp;</p><p>Now, what I'm curious about is that I did never set no_network to False.</p><p>Here's how I initialize lxml:&nbsp;</p><p>&nbsp;</p><p>def _register():<br>&nbsp;&nbsp;&nbsp; """Register lxml objectify module with pytaf standard settings.<br>&nbsp;&nbsp;&nbsp; Needs not be explicitly called when importing xmsg from a pytaf installation<br>&nbsp;&nbsp;&nbsp; as this is done on first xmsg module import.<br>&nbsp;&nbsp;&nbsp; """<br>&nbsp;&nbsp;&nbsp; # set a default parser that removes whitespace in mixed-content elements<br>&nbsp;&nbsp;&nbsp; parser = etree.XMLParser(remove_blank_text=True)<br><br>&nbsp;&nbsp;&nbsp; # enable ns/tag-based lookup that falls back on pytype/xsi:type/guess-lookup<br>&nbsp;&nbsp;&nbsp; lookup = etree.ElementNamespaceClassLookup(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; objectify.ObjectifyElementClassLookup())<br>&nbsp;&nbsp;&nbsp; parser.setElementClassLookup(lookup)<br>&nbsp;&nbsp;&nbsp; # set our parser as objectify default parser<br>&nbsp;&nbsp;&nbsp; objectify.setDefaultParser(parser)<br>&nbsp;&nbsp;&nbsp; # Set our parser as etree default parser, too. Otherwise etree.Element()<br>&nbsp;&nbsp;&nbsp; # returns etree._Element instead of ObjectifiedElements<br>&nbsp;&nbsp;&nbsp; etree.setDefaultParser(parser) <br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; # enable recursive pretty-printing of ObjectifiedElements<br>&nbsp;&nbsp;&nbsp; objectify.enableRecursiveStr()<br></p><p>&nbsp;</p><p>??&nbsp;</p><p>Holger&nbsp;</p><p></p><p></p><p></p><p></p><p></p><p></p><div class="signature"><br /><br /><br />-- <br />GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.<br />Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail</div></body></html>