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


XML Objectified: IDOMElement

December 21, 1998

Now that we have some practice with references and know how to determine the type of node, let's focus on the IDOMElement node and begin climbing the XML tree. The trunk itself -- the root XML element node, is the IDOMElement child of the IDOMDocument object. Now that we're focused on the XML tree, and specifically the "trunk", we return to the arboreal tree metaphor.

Recall that the trunk of our pets.xml tree is the element <petfolio>. We can verify this via the nodeName property of the IDOMElement object:

petbase.childNodes(1).nodeName

yields

"petfolio"

As the trunk of our XML tree, petfolio leads to two branches, each one being a <pet> element. Therefore, if we want to examine or modify an existing branch of this tree, we will have to climb a bit further into one of these pet nodes. Using the length property of the childNodes list our program can determine that two branches are connected to the trunk:

petbase.childNodes(1).childNodes.length

yields

2

Two branches, although we don't know that both branches are necessarily pet nodes (though they are in this example). This is easy enough to verify, however:

petbase.childNodes(1).childNodes(0).nodeName

yields

"pet"
petbase.childNodes(1).childNodes(1).nodeName yields "pet"

Understandably, these reference syntaxes are growing rather intimidating, as we climb higher and higher into the XML tree. Most real-world programs will rely on shortcuts to these references, but we write them out explicitly here so you can best follow along.


XML Objectified: IDOMNode's
XML via the Document Object Model: A Preliminary Course
XML Objectified: Attributes Considered


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