May 27, 2021 XML DOM
Properties and methods define the programming interface to the XML DOM.
The DOM simulates XML as a series of node objects. N odes can be accessed through JavaScript or other programming languages. In this tutorial, we use JavaScript.
The programming interface to the DOM is defined by a standard set of properties and methods.
Properties are often used in the "what is something" way (for example, the node name is "book").
Methods are often used in the "what to do with something" approach (for example, removing the "book" node).
Some typical DOM properties:
Note: In the list above, x is a node object.
Note: In the list above, x is a node object.
Get the JavaScript .xml the text from the element of the "books.xml .
txt=xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue
After the statement is executed, the value saved by txt is "Everyday Italian".
Explain: