Documents

An entire XML document is represented by a special type of node. An important concept to appreciate at this point is that the root element of an XML document is not the root node of the DOM. If it were, it would not be possible for the DOM to contain nodes that represent markup around the root element, such as a preceding comment or following processing instruction. The Document interface extends the Node interface, adding a number of methods. The first four of these methods obtain information about the document. The remainder are 'factory' methods, used to create new objects to put in the document:

 DocumentType getDoctype(); DOMImplementation getImplementation(); Element getDocumentElement(); NodeList getElementsByTagName(String tagName); ...

Get XML Companion, The, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.