Open Directory Site XMLDOM Tutorials

ASP | XML | VBScript | JavaScript | ADO | CSS | XMLDOM | PHP | Operating Systems

Home >> XMLDOM >>Introduction to the XML DOM

Introduction to the XML DOM

 

The XML Document Object Model (DOM) is a programming interface for XML documents. It defines the way an XML document can be accessed and manipulated.

Introduction

As a W3C specification, the objective for the XML DOM has been to provide a standard programming interface to a wide variety of applications. The XML DOM is designed to be used with any programming language and any operating system.

With the XML DOM, a programmer can create an XML document, navigate its structure, and add, modify, or delete its elements.

The Node Interface

As you will see in the next section, a program called an XML parser can be used to load an XML document into the memory of your computer. When the document is loaded, its information can be retrieved and manipulated by accessing the DOM.

The DOM represents a tree view of the XML document. The documentElement is the top-level of the tree. This element has one or many childNodes that represent the branches of the tree.

A Node Interface Model is used to access the individual elements in the node tree. As an example, the childNodes property of the documentElement can be accessed with a for/each construct to enumerate each individual node.

The Microsoft XML parser supports all the necessary functions to traverse the node tree, access the nodes and their attribute values, insert and delete nodes, and convert the node tree back to XML.

(Believe it or not: The official DOM does not include standard functions for loading XML documents !!)

The following table lists the most commonly used node types supported by the Microsoft XML parser:

Node Type Example

Document type <!DOCTYPE food SYSTEM "food.dtd">

Processing instruction <?xml version="1.0"?>

Element <drink type="beer">Carlsberg</drink>

Attribute type="beer"

Text Carlsberg

Cheap Web Hosting Articles - Web Site Design & Web Hosting Tutorials - Domain Hosting