[XML-SIG] DOM seems incomplete

Andrew Clover and-xml at doxdesk.com
Tue Aug 10 14:23:43 CEST 2004


Markus Jostock <markus.jostock at softwareag.com> wrote:

> Accessing doc.firstChild is ok:
> print doc.firstChild.nodeName  prints MYXML

doc.firstChild is not what you might expect:

   print doc.firstChild
   <DocumentType Node at b59d50: Name='MYXML' with [no children]>

A DocumentType node happens to have the same nodeName as the root 
element, because when you say <!DOCTYPE blah []>, 'blah' must match the 
root element.

(It's a minor wart that the 4DOM parsers always create a DocumentType 
node even when no <!DOCTYPE> was declared in the source.)

> Where are my children gone?

In doc.documentElement.childNodes.

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/


More information about the XML-SIG mailing list