http://java.sun.com/webservices/jaxp/faq.html
The JAXP 1.1 API allows applications to plug in different JAXP compatible implementations of parsers or XSLT processors. For example, when an application wants to create a new JAXP DocumentBuilderFactory
instance, it calls the staic method DocumentBuilderFactory.newInstance()
. This causes a search for the name of a concrete subclass of DocumentBuilderFactory
using the following order:
- The value of a system property like
javax.xml.parsers.DocumentBuilderFactory
if it exists and is accessible. - The contents of the file
$JAVA_HOME/jre/lib/jaxp.properties
if it exists. - The Jar Service Provider discovery mechanism specified in the Jar File Specification. A jar file can have a resource (i.e. an embedded file) such as
META-INF/services/javax.xml.parsers.DocumentBuilderFactory
containing the name of the concrete class to instantiate. - The fallback platform default implementation.
Of the above ways to specify an implementation, perhaps the most useful is the jar service provider mechanism. To use this mechanism, place the implementation jar file on your classpath. For example, to use Xerces 1.4.4 instead of the version of Crimson which is bundled with JDK 1.4 (Java Development Kit version 1.4), place xerces.jar in your classpath. This mechanism also works with older versions of the JDK which do not bundle JAXP. If you are using JDK 1.4 and above, see this question for potential problems.
没有评论:
发表评论