List of Examples List of Figures Preface Who You Are What You Need to Know What You Need to Have How to Use This Book The Online Edition Some Grammatical Notes Contacting the Author Acknowledgments Part I XML Chapter 1 XML for Data Motivating XML A Thought Experiment Robustness Extensibility Ease-of-Use XML Syntax XML Documents XML Applications Elements and Tags Text Attributes XML Declaration Comments Processing Instructions Entities Namespaces Validity DTDs Schemas Schematron The Last Mile Stylesheets CSS Associating Stylesheets with XML Documents XSL Summary Chapter 2 XML Protocols: XML-RPC and SOAP XML as a Message Format Envelopes Data Representation HTTP as a Transport Protocol How HTTP Works HTTP in Java RSS Customizing the Request Query Strings How HTTP POST Works XML-RPC Data Structures Faults Validating XML-RPC SOAP A SOAP Example Posting SOAP Documents Faults Encoding Styles SOAP Headers SOAP Limitations Validating SOAP Custom Protocols Summary Chapter 3 Writing XML with Java Fibonacci Numbers Writing XML Better Coding Practices Attributes Producing Valid XML Namespaces Output Streams, Writers, and Encodings A Simple XML-RPC Client A Simple SOAP Client Servlets Summary Chapter 4 Converting Flat Files to XML The Budget The Model Input Determining the Output Format Validation Attributes Building Hierarchical Structures from Flat Data Alternatives to Java Imposing Hierarchy with XSLT The XML Query Language Relational Databases Summary Chapter 5 Reading XML InputStreams and Readers XML Parsers Choosing an XML API Choosing an XML Parser Available Parsers SAX DOM JAXP JDOM dom4j ElectricXML XMLPULL Summary Part II SAX Chapter 6 SAX What Is SAX? Parsing Callback Interfaces Implementing ContentHandler Using the ContentHandler The DefaultHandler Adapter Class Receiving Documents Receiving Elements Handling Attributes Receiving Characters Receiving Processing Instructions Receiving Namespace Mappings "Ignorable White Space" Receiving Skipped Entities Receiving Locators What the ContentHandler Doesn't Tell You Summary Chapter 7 The XMLReader Interface Building Parser Objects Input InputSource EntityResolver Exceptions and Errors SAXExceptions The ErrorHandler Interface Features and Properties Getting and Setting Features Getting and Setting Properties Required Features Standard Features Standard Properties Xerces Custom Features Xerces Custom Properties DTDHandler Summary Chapter 8 SAX Filters The Filter Architecture The XMLFilter Interface Content Filters Filtering Tags Filtering Elements Filtering Attributes Filters That Add Content Filters versus Transforms The XML Filterlmpl Class Parsing Non-XML Documents Multihandler Adapters Summary Part III DOM Chapter 9 The Document Object Model The Evolution of DOM DOM Modules Application-Specific DOMs Trees Document Nodes Element Nodes Attribute Nodes Leaf Nodes Nontree Nodes What Is and Isn't in the Tree DOM Parsers for Java Parsing Documents with a DOM Parser JAXP DocumentBuilder and DocumentBuilderFactory DOM3 Load and Save The Node Interface Node Types Node Properties Navigating the Tree Modifying the Tree Utility Methods The NodeList Interface JAXP Serialization DOMException Choosing between SAX and DOM Summary Chapter 10 Creating XML Documents with DOM DOMImplementation Locating a DOMImp]ementation Implementation-Specific Class JAXP DocumentBuilder DOM3 DOMImplementationRegistry The Document Interface as an Abstract Factory The Document Interface as a Node Type Getter Methods Finding Elements Transferring Nodes between Documents Normalization Summary Chapter 11 The DOM Core The Element Interface Extracting Elements Attributes The NamedNodeMap Interface The CharacterData Interface The Text Interface The CDATASection Interface The EntityReference Interface The Attr Interface The ProcessingInstruction Interface The Comment Interface The DocumentType Interface The Entity Interface The Notation Interface Summary Chapter 12 The DOM Traversal Module NodeIterator Constructing NodeIterators with DocumentTraversal Liveness Filtering by Node Type NodeFilter TreeWalker Summary Chapter 13 Output from DOM Xerces Serialization OutputFormat DOM Level 3 Creating DOMWriters Serialization Features Filtering Output Summary Part IV JDOM Chapter 14 JDOM What Is JDOM? Creating XML Elements with JDOM Creating XML Documents with JDOM Writing XML Documents with JDOM Document Type Declarations Namespaces Reading XML Documents with JDOM Navigating JDOM Trees Talking to DOM Programs Talking to SAX Programs Configuring SAXBuilder SAXOutputter Java Integration Serializing JDOM Objects Synchronizing JDOM Objects Testing Equality Hash Codes String Representations Cloning What JDOM Doesn't Do Summary Chapter 15 The JDOM Model The Document Class The Element Class Constructors Navigation and Search Attributes The Attribute Class The Text Class The CDATA Class The ProcessingInstruction Class The Comment Class Namespaces The DocType Class The EntityRef Class Summary Part V XPath/XSLT Chapter 16 XPath Queries The XPath Data Model Location Paths Axes Node Tests Predicates Compound Location Paths Absolute Location Paths Abbreviated Location Paths Combining Location Paths Expressions Literals Operators Functions XPath Engines XPath with Saxon XPath with Xalan DOM Level 3 XPath Namespace Bindings Snapshots Compiled Expressions Jaxen Summary Chapter 17 XSLT XSL Transformations Template Rules Stylesheets Taking the Value of a Node Applying Templates The Default Template Rules Selection Calling Templates by Name TrAX Thread Safety Locating Transformers The xml-stylesheet Processing Instruction Features XSLT Processor Attributes URI Resolution Error Handling Passing Parameters to Stylesheets Output Properties Sources and Results Extending XSLT with Java Extension Functions Extension Elements Summary Part VI Appendixes Appendix A XML API Quick Reference SAX org.xml.sax org.xml.sax.ext org.xml.sax.helpers DOM The DOM Data Model org.w3c.dom org.w3c.dom.traversal JAXP javax.xml.parsers TrAX javax.xml.transform javax.xml.transform.stream javax.xml.transform.dom javax.xml.transform.sax JDOM org.jdom org.jdom.fiher org.jdom.input org.jdom.output org.jdom.transform org.jdom.xpath XMLPULL org.xmlpull.v1 Appendix B SOAP 1.1 Schemas The SOAP 1.1 Envelope Schema The SOAP 1.1 Encoding Schema W3C Software Notice and License Appendix C Recommended Reading Books Specifications Index