Using an XML catalog with Python's lxml?
<p>Is there a way, when I parse an XML document using lxml, to validate that document against its DTD using an external catalog file?   I need to be able to work the fixed attributes defined in a documentâs DTD.</p>

<p>You can add the catalog to the <code>XML_CATALOG_FILES</code> environment variable:</p>

<pre><code>os.environ['XML_CATALOG_FILES'] = 'file:///to/my/catalog.xml'
</code></pre>

<p>See <a href="http://thread.gmane.org/gmane.comp.python.lxml.devel/5907" rel="nofollow">this thread</a>. Note that entries in <code>XML_CATALOG_FILES</code> are space-separated URLs. You can use Python's <code>pathname2url</code> and <code>urljoin</code> (with <code>file:</code>) to generate the URL from a pathname.</p>
