Main Components of An XML Document
Main Components of An XML Document
Document
Elements: <hello>
Advanced Components
– CData Sections
– Processing Instructions
The Basic Rules
var attributeValue;
//get an attribute value by specific name
attributeValue = elementNode.getAttribute("articleID");
//print it out
document.writeln("Attribute value: <b>" + attributeValue +
" </b><br>");
}
Cautions with DOM
Make sure that the XML file resides in the same directory as
the html file with the JavaScript code
The Attribute node does not appear as the child node of any
other node type; it is not considered a child node of an
element