Type/Return Type Description
Pointer to the next sibling;
if this is the last
Returns true when
contains one or
objects representing an element’s
attributes; only used for
to the end of
In addition to nodes, the DOM also defines some helper objects, which are used to work with nodes but
are not necessarily part of a DOM document:
— an array of nodes indexed numerically; used to represent child nodes of an element
— an array of nodes indexed both numerically and name; used to represent ele-
These helper objects provide additional access and traversal methods for dealing with DOM document.
Usage specifics are discussed later.
Any XML-based language, such as XHTML and SVG, can make use of the core DOM just introduced
because they are technically XML. However, many languages go on to define their own DOMs that
extend the XML core to provide language-specific features.
Along with developing the XML DOM, the W3C concurrently developed a DOM more specific to
XHTML (and HTML). This DOM defines an
as the basis for the imple-
mentation. Each HTML element is represented by its own
type, such as
, with the exception of a small subset of elements that don’t require special properties
or methods other than those provided by
. Throughout the rest of the book, you are intro-
duced to various HTML DOM features as well as to the core XML DOM features.
Regular HTML is not valid XML; however, most modern Web browsers are forgiv-
ing and still parse an HTML document into a proper DOM document (even without
the XML prolog). However, it’s always best to use XHTML code when programming
Web pages to eliminate bad coding habits.
09_579088 ch06.qxd 3/28/05 11:37 AM Page 166