Java & XML, ition: Solutions to Real-World Problems by Brett McLaughlin

Because the input document is often not fixed, an XPath expression can result in the evaluation of no input data, one input element or attribute, or multiple input elements and attributes.

As a sample to familiarize you with SAX, this chapter details the SAXTreeViewer class. This class uses SAX to parse an XML document supplied on the command line, and displays the document visually as a Swing JTree. If you don't know anything about Swing, don't worry; I don't focus on that, but just use it for visual purposes. The focus will remain on SAX, and how events within parsing can be used to perform customized action. All that really happens is that a JTree is used, which provides a nice simple tree model, to display the XML input document.

This points to the definitions for each of these elements in another part of the schema, and keeps things organized and easy to follow. Later in the file, the title element is defined: 30 Java & XML, 2nd Edition This element is really just a simple XML Schema string type; however, I've added an attribute to it, so I must define a complexType.

Download PDF sample

Rated 4.48 of 5 – based on 13 votes