Home > Articles

The Parser and DOM

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Document Object Model

Originally, the W3C developed DOM for browsers. DOM grew out of an attempt to unify the object models of Netscape Navigator 3 and Internet Explorer 3. The DOM recommendation supports both XML and HTML documents.

The current recommendation is DOM level 2, but most browsers still support only level 1. Level 1 supports well-formed documents. DOM level 2 builds on level 1; it adds support for styling, events, document traversal and, most importantly, XML namespaces. Level 3 is under development at the time of this writing.

DOM's status as the official recommendation from the W3C means that most parsers support it. DOM is also implemented in browsers, meaning that you can write DOM applications with a browser and JavaScript.

As you can imagine, DOM has defined classes of objects to represent every element in an XML file. There are objects for elements, attributes, entities, text, and so on. Figure 7.5 shows the most important objects in the DOM hierarchy.

Figure 7.5: The hierarchy in DOM.

  • + Share This
  • 🔖 Save To Your Account