| |
e532. Visiting All the Elements in a DOM Document
// Obtain an XML document; this method is implemented in
// e510 The Quintessential Program to Create a DOM Document from an XML File
Document doc = parseXmlFile("infilename.xml", false);
// Get a list of all elements in the document
NodeList list = doc.getElementsByTagName("*");
for (int i=0; i<list.getLength(); i++) {
// Get element
Element element = (Element)list.item(i);
}
e531.
Getting a DOM Element by Id
e533.
Changing the Name of a DOM Element
© 2002 Addison-Wesley.
| | |