The Document Interface

The document interface returns information about the document itself. Of these, the one that will be used most often is the documentElement attribute that creates a node of the root element of the document. If you are walking the document tree to find an element, this is a great way to start. The document interface has the following read-only attributes:

doctype

implementation

documentElement

The first eight methods of the document interface listed below are mainly concerned with creating different kinds of nodes. (As you will learn, the ninth, getElementsByTagName(), is of special importance.)

The interface has the following methods:

  • createElement()

  • createDocumentFragment()

  • createTextNode()

  • createComment() ...

Get XML Unleashed 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.