| Questions |
| Augmentations Overriding Default Parser Configuration
| Answers |
| What are all these strange "Augmentations" parameters I see in so many methods? |
| They're intended to provide a way to augment the basic XML infoset available from the non-Augmentation parameters in the callbacks. They can be used by a component to add arbitrary information to the streaming infoseet, which can then be interpreted by some later component. For instance, a component can be written to transmit the post schema validation infoset through Augmentations callbacks. This can then be translated into an XML representation. This is exactly what is done in the PSVI Writer and PSVI Configuration samples--see XNI sample documentation for details.
| How do I change the default parser configuration? |
| It is possible to override the default parser configuration used by the Xerces2 parsers without writing any code or changing the existing parser classes. Moreover, the DOM and SAX parsers created using the JAXP interfaces will use the specified parser configuration transparently and without need to call additional methods to set the parser configuration. The DOM and SAX parsers decide which parser configuration to use in the following order: First, the `org.apache.xerces.xni.parser.XMLParserConfiguration` system property is queried for the class name of the parser configuration. Next, the `org.apache.xerces.xni.parser.XMLParserConfiguration` file is requested from the `META-INF/services/` directory. This file contains the class name of the parser configuration. Finally, the `org.apache.xerces.parsers.StandardParserConfiguration` is used as the default parser configuration.
| In all cases, the parser configuration class must have a public, no argument constructor so that it can be instantiated dynamically.
When using Java 2, it is not necessary to rebuild the Xerces jar files in order to override the default parser configuration using the first method. As long as a JAR file containing the appropriate file exists in the `META-INF/services/` directory appears before the Xerces JAR files, the parser will use the new parser configuration. The first method can always be used on the command line for the JVM by using the `-D` option. For example, to override the default parser configuration using a custom configuration named `MyConfig`, use the following command line:
    java -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=MyConfig application_class

Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.