XML and Java: DOM Level 1: Java XML API Definitions (W3C)
December 9, 1998
URL:
http://www.w3.org/TR/REC-DOM-Level-1/java-language-binding.html
In contrast to the event-based model of SAX, the W3C's Document
Object Model Level 1typifies a tree-base model. The pros and cons of these
two different approaches
are covered in Part 1 of this article. The key point
is that the DOM is an in-memory tree representation of the document
after the parsing completes.
The Java Language Binding for the DOM are
downloadable
from the W3C site. There is a Core (XML) portion and an HTML portion.
In the Core, the following Java interfaces are defined for XML processing,
with the Node being the most significant.
-
Node, NodeList, NamedNodeMap
- Attr, Element
- Document, DocumentFragment, DocumentType
- CharacterData, Text, Comment, CDATASection
- Notation, Entity, EntityReference
- ProcessingInstruction
Since everything is a Node, you have to use the getNodeType
method to determine whether you're dealing with, for instance, an Element
node, and then getAttributes to retrieve the element's
attributes.
In the HTML portion, Java interfaces such as HTMLDocument, HTMLElement,
HTMLBodyElement, HTMLListElement, HTMLFormElement, HTMLScriptElement,
HTMLAppletElement, and so on are defined.
The DOM is supported by XML Library, IBM's XML Parser for Java,
SAXON, the Docuverse DOM SDK, and Coins. Since the DOM specifies an
interface, expect that each vendors's implementation will differ with
respect to details and extra features (such as convenience methods).
See also the
DOM
Level 1 Recommendation, the
DOM Activity page, and the
DOM home page
from the W3C site, and of course the WDVL article,
The DOM Dissected.
XML and Java: XML Productivity Kit for Java (XPK4J by IBM)
XML and Java: The Perfect Pair: Part 2: Java APIs for XML
XML and Java: Serialization APIs
|