Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A question about DOM 1

Status
Not open for further replies.

NMDUC

Programmer
Mar 4, 2006
61
VN
Hi,
Sorry because I don't have good knowledge of DOM.
For example, we have this document

<note time="12:03:46">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>I forget</body>
</note>

And if we represent it as a tree, we will have

note
/ / \ \
to from heading body
| | | |
Tove Jani Reminder I forget

I don't know how to draw the attribute in this tree structure. Please help me.

And I get confused with the element node, attribute node and text node. In this tree, are the nodes such as to, from, heading, body the element nodes?

Thank you in advance.
 
I don't think there is a standard make everyone follow for a graphic representation.

The document tree they are talking is mainly a tree of element nodes, because only element nodes are capable of being a container. All else are only leaves to the tree.

Hence, in your case, I would guess sticking a line out from note root and end up with time would be enough. Only, time is an attribute node which has to be differentiate from other element nodes. But, this may not score 100 points because people can have all the manner to their liking.
 
So, we will get

note
/ / \ \ \
to from heading body time
| | | | |
Tove Jani Reminder I f 12:03:46


Thank for your answer.
 
You might find it useful to get an idea of how they try to render the structure graphically from DrawTag's introductory page.
Also some ide's for xml has some graphic rep to make them look more sophisticate and worth the money.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top