• Getting and setting parser features
• Working with namespaces
• Validating XML documents
As in the introductory tutorial, the APIs I'll cover are:
• The Document Object Model (DOM), Levels 1, 2, and 3
• The Simple API for XML (SAX), Version 2.0
• JDOM, a simple Java API created by Jason Hunter and Brett McLaughlin
• The Java API for XML Processing (JAXP)
I'll also cover several approaches to validation, including W3C XML Schema, RELAXNG, and Schematron.
About the examples
Most of the examples here will work with the Shakespearean sonnet that appeared in the last tutorial. The structure of this sonnet is:
[14
In the various sample programs, some versions of this document will have namespaces, and some will use DTDs, W3C XML Schemas, or other schema languages for validation. For the complete examples, see the following files:
• sonnet.xml
• sonnet.dtd (download to view in a text editor)
• sonnetNamespaces.xml
• sonnet.xsd
• sonnetSchema.xml
• sonnet.rng
• sonnetRules.xsl
• sonnetSchematron.xml
As an alternative, download x-java2_code_files.zip to view these files in a text editor.
Download this tutorial