Java Reference
In-Depth Information
<text angle="0.3183694064160789">
<color B="0" G="255" R="0"/>
<position x="42.0" y="283.0"/>
<font fontname="Comic Sans MS" fontstyle="bold-italic" pointsize="18"/>
<string>
<bounds width="271" height="21"/>
The Complete Set! &quot;Try it out&quot;
</string>
</text>
</sketch>
This file is also available as sketchexample.xml in the code download for this topic from the Wrox
Press web site, http://www.wrox.com . You could try importing it into Sketcher and see if you get the
same sketch.
Summary
In this chapter we have discussed how we can use a DOM parser to analyze XML and how JAXP
supports the synthesis and modification of XML documents using DOM. The key points we have
covered include the following:
An object of type DocumentBuilder encapsulates a DOM parser.
You create an object encapsulating a DOM parser by using a DocumentBuilderFactory
object that you obtain by calling the static newInstance() method that is defined in the
DocumentFactoryBuilder class.
You can parse an XML document by passing the document as an argument to the parse()
method for a DocumentBuilder object.
A DOM parser creates a Document object that encapsulates an entire XML document as a
tree of Node objects.
The DOM API defines the methods that a Document object has that enable you to analyze an
XML document by navigating through the nodes in the Document object.
The DOM API also defines methods for creating a new XML document encapsulated by a
Document object.
When you want to create a new XML document that includes a DTD you should use the
createDocument() method for a DOMImplementation object rather than the
newDocument() method for a DocumentBuilder object.
Search WWH ::




Custom Search