Forgot username/password? Don't have an account?
Login with Facebook
Home » Courses » 02Hero XML » XML DOM
Subscribe for updates.
* New to us? log in with Facebook and get a free day pass


XML DOM stands for XML Document Object Model. DOM is designed to be an interface to a tree-based representation of an XML document. In DOM, every XML entity (element, content, comments) is represented by a node object, where a node is a vertex in the XML tree representation. Different programming and scripting languages (such as Javascript, Perl, Java, etc.) that support information management through an XML API, chiefly support the XML DOM API. We will describe the functionality of the DOM API organization and features by looking at a real-world example.

Consider, for example, a corporate aerospace giant that has a hierarchical employee structure: nodes represent employees, and connecting tree edges (lines) indicate immediate supervisor and subordinates.

A DOM Interface provides an API that can be invoked by the user's program, and it is used to recursively traverse the XML document tree. It has certain standard, flexible API methods such as:

firstSibling(,) lastSibling(,) nextSibling(,) parent(,) firstChild(,) lastChild(,) and nextChild() among others. We shall now see how these APIs can be used to navigate the XML document. As is apparent, this is a very general API: the programmer doesn't need to know beforehand the number of elements, nested elements, etc. in the XML document.

Consider in particular the node representing the employee whose title is "VP Research & Development." In this node context, the above-mentioned API would return the following results, by traversing the tree in downward or upward direction, depending on the requirement:

firstSibling(): "VP Operations"

lastSibling(): "VP Business & Management"

nextSibling(): "VP Business & Management"

parent(): "President & CEO"

firstChild(): "PE Research & technology"

lastChild(): "PE Deployment"

nextChild(): (Depends on context)

To illustrate these results, note that the DOM internally maintains a pointer or marker to determine which node of the XML DOM tree is the current one. All the above operations return values relative to the current position of the pointer.

The DOM model is an old model found in early literature describing the invention of XML and related standards. Modern day XML-parsing standards have moved ahead, but we are learning about the DOM since there is a very large code-base out there in terms of XML language libraries and client code. DOM, in its heyday, had a huge following and is still the most general API around.

Got A Question?

'I love being Prime'

Have a question but don't want to ask it publicly? If you are a prime member just ask right here and we will get back to you within 48 hours. Not prime yet? no worries you can ask publicly below.

Act now while we have available seating

Our on line school is private, affordable and interactive with trainer support.
Act now save your seat before someone else takes yours.
Act now