Re: The DOM HTML model

At 09:11 AM 5/25/98 -0400, Heikki Vesalainen wrote:
>Hmm..
>
> I just read the DOM Specification through and a question came to my
>head:
>
> If I have understood correctly the documents being altered with
>the DOM model are being parsed and put into a tree-like structure so that
[snip]

>Now to the question... How would the following HTML be parsed?
>
><P>How would <B>This</B> be parsed?</P>
>
>is it 
>a) 
>P: "How would", B, "be parsed?"
>B: "This"
>
>or 
>
>b)
>P: "How would <B> this </B> be parsed?"

I'm not sure I understand; is the issue that the "B" tag is "really" for
procedural markup rather than being structural?  
In any event, the DOM doesn't get into this; HTML tags should parse into a
DOM element object.  The representation of text in the DOM is a subject of
dispute, but as it stands now,a DOM-aware parser should produce a tree
something like:
              HTMLDocument  
                 |
                 P
              /  |  \
"How would"      B  " be parsed?"
                 |
               "this"
   
In words, since my ASCII drawing may get reformattted ... there is 
an HTMLDocument object that contains one P element.  The P element has 3
children, a TextNode with the string "How would ", a B element, and another
text node containing the string " be parsed?".  The B element has one
child, a TextNode containing the string "this".

Does this answer the question?

Mike Champion

Received on Monday, 25 May 1998 11:34:45 UTC