Content Nodes

The actual data conveyed by an XML document is contained completely within the document element. The following node types map directly to the XML document’s nonstructural parts, such as character data, elements, and attribute values.

Document

Each parsed document causes the creation of a single Document node in memory. (Empty Document nodes can be created through the DOMImplementation interface.) This interface provides access to the document type information and the single, top-level Element node that contains the entire body of the parsed document (the documentElement). It also provides access to the class factory methods that allow an application to create new content nodes that were not created by parsing a document. Table 19-10 shows all attributes and methods of the Document interface.

Table 19-10. The Document interface, derived from Node

Name

Type

Read-only

2.0

3.0

Attributes

    

doctype

DocumentType

  

documentElement

Element

  

documentURI

DOMString

  

domConfig

DOMConfiguration

 

implementation

DOMImplementation

  

inputEncoding

DOMString

 

strictErrorChecking

boolean

  

xmlEncoding

DOMString ...

Get XML in a Nutshell, 3rd 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.