W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

Re: Newbie questions?

From: <keshlam@us.ibm.com>
Date: Fri, 16 Oct 1998 15:34:32 -0400
To: www-dom@w3.org
Message-ID: <8525669F.0069D02D.00@us.ibm.com>
>1) Where can I find the DOM FAQ?

I don't know of an official FAQ, though Don Park has just started
assembling a list clarifying some of the less obvious points (
http://www.docuverse.com/domspec/consensus.html) which might evolve into

>2) Is the root node "<TABLE>" or is "<TABLE>" the first child node of
>the document?

The example is only a portion of a document, out of context ("taken from an
HTML document"). But if it was the whole document, the <TABLE> Element
would be a child of a Document, and would in fact be the only Element child
of that Document, retrievable either as a child or via the
Document.getDocumentElement method.

>3) Finally, the spec says NodeList "contains all children of this
>node".    That would seemingly include grandchildren, right?

Children means immediate children only.

There are two methods that return NodeList. One, getChildren, returns the
immediate kids as per your quote. The other, getElementsByTagName (which
can only be issued against Documents and Elements), returns all descendents
which are Elements and have the specified name.

I haven't gone through your dumpNode() method in detail, but the concept's
valid: Recursive tree-walk each node outputs its immediate contents (in
whatever format is appropriate for that node type -- obviously you haven't
dealt with them all, and you have to watch out for the fact that
CDATASection isa Text!), followed by outputting each of the children if
any, in turn (via either getFirstChild/getNextSibling, or
getChildNodes/item), followed by the end-tag if this node type has one.

Joe Kesselman  / IBM Research
Unless stated otherwise, all opinions are solely those of the author.
Received on Friday, 16 October 1998 15:20:02 UTC

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