Java Reference
In-Depth Information
Entity reference node :areferencetoaDTD-declaredentity.Eachentityreferen-
cenodehasaname,andisincludedinthetreewhentheparserdoesnotreplace
entity references with their values. The parser never includes entity reference
nodesforcharacterreferences(suchas & or Σ )becausetheyare
replaced by their respective characters and included in a text node.
Notation node :aDTD-declarednotation.AparserthatreadstheDTDattaches
amapofnotationnodes(indexedbynotationname)tothedocumenttypenode.
Each notation node has a name, and a public identifier or a system identifi-
er,whicheveridentifierwasusedtodeclarethenotationintheDTD.Notation
nodes do not have children.
Processing instruction node : a processing instruction that appears in the doc-
ument. It has a name (the instruction's target), a string value (the instruction's
data), and a parent (its containing node).
Text node :documentcontent.Itsnameis #text anditrepresentsaportionof
anelement'scontentwhenaninterveningnode(e.g.,acomment)mustbecre-
ated.Characterssuchas < and & thatarerepresentedinthedocumentviachar-
acterreferencesarereplacedbytheliteralcharactersthattheyrepresent.When
these nodes are written to a document, these characters must be escaped.
AlthoughthesenodetypesstoreconsiderableinformationaboutanXMLdocument,
there are limitations (such as not exposing whitespace outside of the root element).
In contrast, most DTD or schema information, such as element types
(<!ELEMENT...>) and attribute types ( <xs:attribute...> ), cannot be ac-
cessed through the DOM.
DOM Level 3 addresses some of the DOM's various limitations. For example, al-
though DOM does not provide a node type for the XML declaration, DOM Level 3
makesitpossibletoaccesstheXMLdeclaration's version , encoding ,and stan-
dalone attribute values via attributes of the document node.
Note Nonroot nodes never exist in isolation. For example, it is never the case for
an element node to not belong to a document or to a document fragment. Even when
suchnodesaredisconnectedfromthemaintree,theyremainawareofthedocumentor
document fragment to which they belong.
Exploring the DOM API
JavaimplementsDOMthroughthe javax.xml.parsers package'sabstract Docu-
mentBuilder and DocumentBuilderFactory classes, along with the nonab-
Search WWH ::




Custom Search