The Node Interface

The primary purpose of the Node interface is to define the base functionality for all node types. It defines the set of attributes, methods, and constants that must be available on any node within the DOM hierarchy. This makes it possible to traverse a DOM hierarchy in a uniform fashion strictly using the Node interface without having to downcast to more specific interface types. The more specific interfaces are available when necessary to access features that only make sense for a given node type.

One of the tradeoffs of a fairly general base interface like Node is that some of its operations do not apply to all of the node types. The DOM working group made a conscious decision to not factor the Node interface to the smallest ...

Get Essential XML: Beyond Markup now with O’Reilly online learning.

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