[XML-SIG] Accessing internal entities with minidom or 4DOM

Fred L. Drake, Jr. fdrake@acm.org
Mon, 22 Jul 2002 16:01:08 -0400


Martin said:
 > Notice that there is no programmatic way to set the entities member of
 > a DocumentType node, so an XML parser would need a private interface
 > to the DOM implementation to set this member to a non-trivial value.
 > 
 > In short, that aspect of the DOM is not implemented in any of the
 > Python DOM implementations.

Not quite true, but close enough for most people.  ;-)  The ParsedXML
DOM I wrote for Zope implements both the notations and entities
attributes of the DocumentType properly (modulo not loading external
entities).  I expect to add this to the minidom when loaded using the
new xml.dom.expatbuilder module, but that hasn't been done yet.

Back to Phil:
 > Ok, I see the problem. But according to the spec I should at least have
 > read-only access to the internal subset. The existence of minimdom's
 > internalSubset property lead me to believe that I should be able to do this
 > at least with minidom, but that maybe I'm doing something wrong in my code.
 > Or are you saying that this particular DOM Level 2 interface is not yet
 > implemented in either minidom or 4DOM?

The new xml.dom.expatbuilder tries pretty hard to fill in the
internalSubset attribute.  It only exists in CVS right now, but will
be part of PyXML 0.8.  If you're inclined to play with CVS, I'd
certainly appreciate any comments you have on the enhancements to
minidom and the xml.dom.expatbuilder module.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation