Re: How can DOM possibly contain a document?

> In the example given of:
>     <STRONG>Hello, <I>I'm </I>doing fine</STRONG>
> I think the confusion is in how many children the STRONG element has.
> my understanding it would have three children.

If the document is in normalized form (as delivered by a parser), that's

     Element node named "STRONG"
          +---- Text node containing "Hello, "
          +---- Element node named "I"
          |         |
          |         +---- Text node containing "I'm "
          +---- Text node containing "doing fine"

If you've been manipulating the document before you reach this point, it's
possible that one of the blocks of text may be made up of several
successive Text nodes. In that case, your code can check for and deal with
this possibility, or can use the normalize() operation to request that
adjacent text node be merged before you begin processing.

Joe Kesselman  / IBM Research

Received on Friday, 24 March 2000 08:57:08 UTC