62 The XML Files: Develo pment of XML/XSL A pplications Using WebSp here Studio
With the default SAX2 namespace processing, the XML reader would report a
start and end element event with the namespace URI http://www.ibm.com and
the local name hr. Most XMLReader imp lementations also report the original
qName html:hr, but that parameter might simply be an empty string (except for
elements that are not in the namespace).
For attributes, you can look up the value of a named attribute using the getValue
method, and you can look up the namespace URI or local name of an attribute by
its index using the getURI and getLocalName methods. If the URI were the empty
string, you would normally use the qName to i dentify the attributes.
In addition to those events, SAX2 reports the scope of namespace declarations
using the startPrefixMapping and endPrefixMapping methods, so that
applications can resolve prefixes in attribute values or character data if
necessary.
3.4 DOM level2
While XML is a language to describe tree-structures data, the Document Object
Model (DOM) defines a set of interfaces to access tree-structures XML
documents. DOM specifies how XML and HTML documents can be represented
as objects. Unlike SAX, DOM also allows creating and manipulating the contents
of XML documents.
DOM level2, contains interfaces for creating a document, importing a node from
one document to another, supporting XML Namespaces, associating stylesheets
with a document, the Cascading Style Sheets object m odel, the Range object
model, filters and iterators, and the Events object model. The DOM Core API
allows the creation and population of a Document object using only DOM API
calls; loading a Document and saving it persistently is left to the product that
implements the DOM API.

DOM hierarchy

The DOM provides a set of standard object interfaces that an XML parser can
use to expose the contents of a document to a c lient application. These
interfaces provide access to all the information from the original document,
organized in a hierarchical tree structure. The base interface for navigating this
tree structure is the Node interface, that defines the necessary m ethods to
navigate and manipulate the tree-structure of XML documents. The methods
include getting, deleting, and modifying the children of a node, as well as
inserting new children to it. Every specific document st ructure is represented in
the DOM by one of the following specialized interfaces:
򐂰Document