Easy Tutorial
❮ Dom Met Node Insertbefore Prop Node Baseuri ❯

XML DOM - Properties and Methods


Properties and methods define the programming interface for XML DOM.


Programming Interface

The DOM represents XML as a set of node objects. These nodes can be accessed through JavaScript or other programming languages. In this tutorial, we use JavaScript.

The programming interface of the DOM is defined by a set of standard properties and methods.

Properties are often used in the way "what something is" (e.g., node name is "book").

Methods are often used in the way "what to do with something" (e.g., remove "book" node).


XML DOM Properties

Some typical DOM properties:

Note: In the above list, x is a node object.


XML DOM Methods

Note: In the above list, x is a node object.


Example

JavaScript code to get the text from the <title> element in books.xml:

txt = xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue

After this statement is executed, txt holds the value "Everyday Italian".

Explanation:

❮ Dom Met Node Insertbefore Prop Node Baseuri ❯