W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2000

Re: doctype declaration

From: <keshlam@us.ibm.com>
Date: Mon, 10 Jul 2000 12:47:28 -0400
To: PBrennan@lowandbonar.com
cc: www-dom@w3.org
Message-ID: <85256918.005C3AC9.00@D51MTA03.pok.ibm.com>
Don't assume that Document.getFirstChild is any particular kind of node.
The DocumentType node may preceed the document's root element, if present.
There may also be comments or PIs preceeding or following the root element.
And in some DOMs, there may be a node for the XML Declaration, if you're
working in XML.

If you want to retrieve the root node (<HTML>, in your case), the best
solution is to use the call specifically designed for that purpose --
Document.getDocumentElement(). Second best is to walk through the
Document's children looking for a node whose type is Element.

Joe Kesselman  / IBM Research
Received on Monday, 10 July 2000 12:49:13 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:07 UTC