Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


A Tree Grows in XML

December 21, 1998

XML data is highly structured in a tree form. This is vitally important because knowing this allows us to traverse this tree programmatically without needing to know the exact configuration of the tree (how many branches does it have, etc.) and without even needing to know the type of data contained within.

Let's look at the petfolio XML document grown as a tree.

Petfolio XML Tree

Artistic skills aside, the above tree serves to represent the structure of the data within the petfolio XML document. We can also see that certain rules preside over this structure: a branch extends from the trunk, smaller branches extend from a larger branch, and leaves extend from these smaller branches; yet, a leaf cannot extend directly from the trunk. Similarly, a branch cannot extend from a leaf -- leaves are terminal nodes, then. A branch, however, can certainly extend from another branch.

Taken together, the rules outlined above describe a hierarchy-based ruleset. Your XML ruleset may be far more complicated, but ultimately you will have leaves which serve as terminal nodes, which hold the meat of your data.

In the lingo of programmers, the terms "parent" and "child" are used to describe the relationships between nodes, veering away from the arboreal tree analogy and towards a family tree analogy. The translation is simple, though: a branch is a child of the trunk and a parent to a leaf. A leaf is a child to a branch and a parent to no one. That last point will be important later -- terminal nodes (a.k.a. "a leaf") cannot be parents. Aside from that, most XML elements can serve as either and both parents and children, just as in living extended families.


Refresher: XML
XML via the Document Object Model: A Preliminary Course
"Exploring" the Tree


Up to => Home / Authoring / Languages / XML / DOM / Intro




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers