|
| |
The Xerces Native Interface (XNI) is an internal API that is
independent of other XML APIs and is used to implement the
Xerces family of parsers. XNI allows a wide variety of parsers
to be written in an easy and modular fashion. The XNI samples
included with Xerces are simple examples of how to program
using the XNI API. However, for information on how to take full
advantage of this powerful framework, refer to the
XNI Manual.
Basic XNI samples:
Parser configuration samples:
Sample xerces.properties
Most of the XNI samples have a command line option that allows the
user to specify a different XNI parser configuration to use. In
order to supply another parser configuration besides the default
Xerces StandardParserConfiguration , the configuration
must implement the
org.apache.xerces.xni.parser.XMLParserConfiguration
interface.
|
| |
This is an example of a component that converts XNI events for a document into
XNI events for that document's PSVI information.
This class can NOT be run as a standalone
program. It is only an example of how to write a component. See
xni.parser.PSVIConfiguration and
xni.parser.PSVIParser.
|
| | | | Sample xni/xerces.properties | | | | |
| |
When you create a Xerces parser, either directly using a native
class like org.apache.xerces.parsers.DOMParser, or via a
standard API like JAXP, Xerces provides a dynamic means of
dynamically selecting a "configuration" for that parser.
Configurations are the basic mechanism Xerces uses to decide
exactly how it will treat an XML document (e.g., whether it
needs to know about Schema validation, whether it needs to be
cognizant of potential denial-of-service attacks launched via
malicious XML documents, etc.) The steps are fourfold:
- * first, Xerces will examine the system property
org.apache.xerces.xni.parser.XMLParserConfiguration;
- next, it will try and find a file called xerces.properties in
the lib subdirectory of your JRE installation;
- next, it will examine all the jars on your classpath to try
and find one with the appropriate entry in its
META-INF/services directory.
- if all else fails, it will use a hardcoded default.
The third step can be quite time-consuming, especially if you
have a lot of jars on your classpath and run applications which
require the creation of lots of parsers. If you know you're
only using applications which require "standard" APIs (that
is, don't need some special Xerces property), or you want to
try and force applications to use only certain Xerces
configurations, then you may wish to copy this file into your
JRE's lib directory. We try and ensure that this file contains
the currently-recommended default configuration; if you know
which configuration you want, you may substitute that class
name for what we've provided here.
|
|
|