XML Training for Java Developers

4 Days

This four-day course builds skills in Java's XML processing APIs. The course is intended for students with a working knowledge of XML -- and possibly DTDs or XML Schema -- who want to build XML applications or components using the Java language. Everything in the course adheres to W3C and Java standards for completely portable code.

The course comprises three modules, which treat XML parsing, XML transformations, and XML binding. The first module introduces the Java API for XML Processing (JAXP) and the two main Java APIs for parsing XML documents: SAX and the DOM. Students learn the basic JAXP architecture and how to create parsers that expose SAX or DOM APIs, and how to configure parsers according to the SAX features and properties specification. SAX parsing gives way to reading and writing document information using the DOM tree model and API.

The second module introduces students to the XPath and XSLT specifications, and how to use JAXP as an interface to XML addressing and transformations. Students learn the JAXP's innovative system of Transformers, Sources, and Results; develop fluency in the exacting but powerful XPath syntax; and then build a number of XSLT transformations.

The third module introduces the newer and more powerful Java API for XML Binding, or JAXB, in its current incarnation, which is version 2.1. JAXB is now emerging as the tool of choice for most XML processing tasks where an XML Schema is available or easy to derive: based on that schema, JAXB-generated types can make it quite easy to read, manipulate, and write XML information models.

  1. Understand the use of SAX and DOM APIs for XML parsing.
  2. Understand the need for JAXP as an additional layer to the standard contract between applications and parsers.
  3. Parse element and attribute content, processing instructions, and other document information using SAX.
  4. Parse documents using the DOM.
  5. Modify, create and delete information in an XML document using the DOM.
  6. Write simple and complex queries into XML document content using XPath.
  7. Use XSLT for XML-to-XML, XML-to-HTML, or XML-to-text transformations.
  8. Build standalone and web applications that build on XSLT transformation logic.
  9. Use JAXB to generate persistent Java object models based on XML Schema.
  10. Implement XML persistence using the JAXB.
  1. XML Parsing Using Java
    1. The Java API for XML Processing (JAXP)
      1. Parsing XML
      2. SAX and DOM
      3. What the W3C Says
      4. What the W3C Doesn't Say
      5. Sun and Apache
      6. JAXP
      7. Parser Factories
      8. Pluggable Parsers
      9. Parser Features and Properties
    2. The Simple API for XML (SAX)
      1. Origins of SAX
      2. The SAX Parser
      3. The SAX Event Model
      4. Reading Document Content
      5. Handling Namespaces
      6. SAX Features for Namespaces
      7. Parsing Attributes
      8. Error Handling
      9. DTD Validation
      10. Schema Validation
      11. Handling Processing Instructions
    3. The Document Object Model (DOM)
      1. Origins of the DOM
      2. DOM Levels
      3. DOM2 Structure
      4. The Document Builder
      5. DOM Tree Model
      6. DOM Interfaces
      7. Document, Node and NodeList Interfaces
      8. Element and Text Interfaces
      9. Finding Elements By Name
      10. Walking the Child List
      11. The Attribute Interface
      12. Traversing Associations
      13. The JAXP Transformer Class
      14. Sources and Results
      15. Combining SAX and DOM Processing
      16. Namespaces and the DOM
    4. Manipulating XML Information with the DOM
      1. Modifying Documents
      2. Modifying Elements
      3. Modifying Attributes
      4. Managing Children
      5. Seeking a Document Location
      6. The ProcessingInstruction Interface
      7. Creating New Documents
  2. XML Transformations Using Java
    1. Using the JAXP for Transformations
      1. XPath, XSLT and Java
      2. The Transformer Class
      3. The TransformerFactory Class
      4. Sources and Results
      5. Identity Transformations
      6. Creating Transformations from Stylesheets
      7. Template Parameters
      8. Output Methods and Properties
      9. Evaluating XPath Expressions
    2. XPath
      1. Use of XPath in Other XML Technologies
      2. XPath Expressions
      3. The Axis
      4. The Node Test
      5. The Predicate
      6. XPath Types
      7. XPath Functions
      8. Implied Context
      9. Querying with XPath
      10. XPath and the DOM
    3. Templates and Production
      1. Rule-Based Transformations
      2. Templates and Template Matching
      3. Built-In Template Rules
      4. Recursion Through Templates
      5. Template Context
      6. Output Methods
      7. Controlling Whitespace
      8. Literal Replacement Elements
      9. Formalizing Text, Elements and Attributes
      10. Defining Target Vocabulary
      11. Generating Processing Instructions
    4. XSLT: Dynamic Content and Flow Control
      1. Web Applications Using XSLT
      2. J2EE and JAXP
      3. Deriving Source Content
      4. Getting Source Values
      5. Attribute Value Templates
      6. Copying Source Elements and Trees
      7. Looping
      8. Conditionals
  3. The Java API for XML Binding
    1. The Java API for XML Binding
      1. The Need for Data Binding
      2. XML Schema
      3. Two Paths
      4. JAXB Compilation
      5. Mapping Schema Types to Java
      6. Java-to-XML Mapping Using Annotations
      7. Marshaling and Unmarshaling
      8. Working with JAXB Object Models
Class Materials

Each student in our Live Online and our Onsite classes receives a comprehensive set of materials, including course notes and all the class examples.

Class Prerequisites

Experience in the following is required for this XML class:

  • Experience in Java Programming, including object-oriented Java and the Java streams model, is essential.
  • Basic understanding of XML is required.
  • XML Schema is used peripherally in the course, and knowledge of this technology will be helpful, but is not required.