8 Sep 13:48
Re: Resolving entities
From: Stefan Behnel <stefan_ml <at> behnel.de>
Subject: Re: Resolving entities
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-09-08 11:48:02 GMT
Subject: Re: Resolving entities
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-09-08 11:48:02 GMT
Kovid Goyal wrote: > My application needs to process XML files that do not have DTD > declarations but that contain entities. In this case your document is not well-formed, i.e. not XML. http://www.w3.org/TR/REC-xml/#sec-references > Can I inform XMLParser of the entities somehow? No, there isn't currently a way to work around such a broken document. libxml2 follows the XML spec strictly in that it rejects references to undeclared entities in the absence of a DTD. ElementTree lacks DTD support and instead allows you to specify entities through a parser local "entity" dictionary. lxml could potentially support a similar interface by intercepting the entity reference resolving at the SAX layer ("getEntity()" callback function), but that's not implemented. Please file a wishlist bug. Stefan
RSS Feed