[XML-SIG] Which python DOM to use - need EntityReference

Andrew Clover and-xml at doxdesk.com
Thu Jan 4 21:03:30 CET 2007

David Fox wrote:

> 1.  Is this true?

Yes, but the lack of maintainer is a recent development. The lack of 
recent development in general is not a recent development. :-)

> 2.  Is there a recommended DOM replacement?  

Not officially. If you need more DOM than minidom there is pxdom and 4Suite.

> I've looked at xml.minidom from the standard python library, but it doesn't
> support EntityReference, which means that I can't escape apostrophes as
> '

pxdom will allow you to do this, although it sounds like a bit of a 
dodgy idea to do with the predefined entities. Would be better to fix 
the incoming parser to correctly support XML if possible - ' and ' 
in content or attribute value are absolutely equivalent to a conforming 
XML processor.

> 3.  Is there any prospect of supporting EntityReference in the standard
> python library?

Not a hope.

Supporting EntityReference properly and correctly is an absolutely 
shocking palaver and would require very large changes to minidom to 
implement - changes that would have a big impact on its performance.

Having been through the pain of implementing EntityReference fully in 
pxdom, I'd say this is one of the very worst aspects of the DOM (and XML 
in general).

> 4. Alternatively, is there some other workaround for dealing with '?

mySerialisedXML.replace("'", ''')?

Nasty, but if you can assume there aren't going to be any apostrophes in 
the document other than in content/attribute values...

And Clover
mailto:and at doxdesk.com

More information about the XML-SIG mailing list