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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.