This page documents the various Java API for XML Processing (JAXP)
samples included with Xerces. Besides being useful programs,
they can be used as JAXP programming examples to learn how to
program using the JAXP API.
A sample which demonstrates usage of classes in the
javax.xml.parsers package, particularly new features introduced
in JAXP 1.3, including XInclude processing, integration with
the JAXP 1.3 Validation API and parser reset.
usage
java jaxp.ParserAPIUsage (options) uri
options
Option
Description
-a uri ...
Provide a list of schema documents.
-api (sax|dom)
Select API to use (sax|dom).
-xi | -XI
Turn on/off XInclude processing.
-sp | -SP
Turn on/off secure processing.
-h
Display help screen.
Sample jaxp.SourceValidator
A sample demonstrating how to use the JAXP 1.3 Validation API
to create a validator and use the validator to validate input
from SAX, DOM or a stream. The output of this program shows the
time spent executing the Validator.validate(Source) method.
This class is useful as a "poor-man's" performance tester to
compare the speed of various JAXP 1.3 validators with different
input sources. However, it is important to note that the first
validation time of a validator will include both VM class load time
and validator initialization that would not be present in subsequent
validations with the same document. Also note that when the source for
validation is SAX or a stream, the validation time will also include
the time to parse the document, whereas the DOM validation is
completely in memory.
The results produced by this program should never be accepted
as true performance measurements.
usage
java jaxp.SourceValidator (options) ...
options
Option
Description
-x number
Select number of repetitions.
-a uri ...
Provide a list of schema documents.
-i uri ...
Provide a list of instance documents to validate.
-vs source
Select validation source (sax|dom|stream).
-f | -F
Turn on/off Schema full checking. NOTE: Not supported by all schema factories and validators.
-hs | -HS
Turn on/off honouring of all schema locations. NOTE: Not supported by all schema factories and validators.
-va | -VA
Turn on/off validation of schema annotations. NOTE: Not supported by all schema factories and validators.
-ga | -GA
Turn on/off generation of synthetic schema annotations. NOTE: Not supported by all schema factories and validators.
-m | -M
Turn on/off memory usage report.
-h
Display help screen.
notes
The speed and memory results from this program should NOT be
used as the basis of parser performance comparison! Real
analytical methods should be used. For better results, perform
multiple validations within the same virtual machine to
remove class loading from parse time and memory usage.
Not all features are supported by different parsers.
Sample jaxp.InlineSchemaValidator
A sample demonstrating how to use the JAXP 1.3 Validation API
to create a validator and use the validator to validate input
from a DOM which contains inline schemas and multiple validation
roots. The output of this program shows the time spent executing
the Validator.validate(Source) method.
This class is useful as a "poor-man's" performance tester to
compare the speed of various JAXP 1.3 validators with different
input sources. However, it is important to note that the first
validation time of a validator will include both VM class load time
and validator initialization that would not be present in subsequent
validations with the same document.
This sample makes use of the JAXP 1.3 XPath API and requires either
a JAXP 1.3 compliant XSLT processor (or JDK 5.0) to run.
The results produced by this program should never be accepted
as true performance measurements.
usage
java jaxp.InlineSchemaValidator (options) uri ...
options
Option
Description
-x number
Select number of repetitions.
-a xpath ...
Provide a list of XPath expressions for schema roots.
-i xpath ...
Provide a list of XPath expressions for validation roots.
-nm pre uri ...
Provide a list of prefix to namespace URI mappings for the XPath expressions.
-f | -F
Turn on/off Schema full checking. NOTE: Not supported by all schema factories and validators.
-hs | -HS
Turn on/off honouring of all schema locations. NOTE: Not supported by all schema factories and validators.
-va | -VA
Turn on/off validation of schema annotations. NOTE: Not supported by all schema factories and validators.
-ga | -GA
Turn on/off generation of synthetic schema annotations. NOTE: Not supported by all schema factories and validators.
-m | -M
Turn on/off memory usage report.
-h
Display help screen.
notes
The speed and memory results from this program should NOT be
used as the basis of parser performance comparison! Real
analytical methods should be used. For better results, perform
multiple validations within the same virtual machine to
remove class loading from parse time and memory usage.
Not all features are supported by different parsers.
Sample jaxp.TypeInfoWriter
Provides a trace of the schema type information for elements and
attributes in an XML document. This demonstrates usage of the
JAXP 1.3 Validation API, particuarly how to read type information
from a TypeInfoProvider.
usage
java jaxp.TypeInfoWriter (options) ...
options
Option
Description
-a uri ...
Provide a list of schema documents.
-i uri ...
Provide a list of instance documents to validate.
-p name
Select parser by name.
-f | -F
Turn on/off Schema full checking. NOTE: Not supported by all schema factories and validators.
-hs | -HS
Turn on/off honouring of all schema locations. NOTE: Not supported by all schema factories and validators.
-va | -VA
Turn on/off validation of schema annotations. NOTE: Not supported by all schema factories and validators.
-ga | -GA
Turn on/off generation of synthetic schema annotations. NOTE: Not supported by all schema factories and validators.
-h
Display help screen.
Sample jaxp.DatatypeAPIUsage
A sample which demonstrates usage of the JAXP 1.3 Datatype API.