3.7.1 Overview of the Parser Switching functionality

The Parser Switching functionality switches the priority order of the XML implementation by XML Processor and the framework or user-specified XML implementation. The XML implementation can be switched to the one supplied with the framework by using this functionality.

By using the Parser Switching functionality, the XML implementation can be switched even in the applications that use frameworks presuming other XML implementations. However, the XML implementation used by the Application Server components cannot be switched from XML Processor with the Parser Switching functionality.

Organization of this subsection
(1) Scope of the Parser Switching functionality
(2) Types of the target XML implementations

(1) Scope of the Parser Switching functionality

The Parser Switching functionality is applicable to J2EE servers. The parser switching settings do not affect other J2EE servers.

Also, even if the Parser Switching functionality is enabled, XML Processor is used to start or deploy a J2EE server instead of the user-specified XML implementation. The following figure shows the scope of the Parser Switching functionality.

Figure 3-20 Scope of the Parser Switching functionality

[Figure]

(2) Types of the target XML implementations

The following table describes the methods used for switching the XML implementation in the JAXP, StAX, and JAXB APIs.

Table 3-9 Names of the methods for switching the XML implementation

No.API typeClass nameMethod name
1JAXP APIjavax.xml.datatype.DatatypeFactorynewInstance()
2javax.xml.parsers.DocumentBuilderFactorynewInstance()
3javax.xml.parsers.SAXParserFactorynewInstance()
4javax.xml.transform.TransformerFactorynewInstance()
5javax.xml.transform.sax.SAXTransformerFactorynewInstance()
6javax.xml.validation.SchemaFactorynewInstance(String schemaLanguage)
7javax.xml.xpath.XPathFactorynewInstance()
8newInstance(String URI)
9org.w3c.dom.bootstrap.DOMImplementationRegistrynewInstance()
10org.xml.sax.helpers.XMLReaderFactorycreateXMLReader()
11StAX APIjavax.xml.stream.XMLInputFactorynewInstance()
12newFactory()
13javax.xml.stream.XMLOutputFactorynewInstance()
14newFactory()
15javax.xml.stream.XMLEventFactorynewInstance()
16newFactory()
17JAXB APIjavax.xml.bind.JAXBContextnewInstance(Class... classesToBeBound)
18newInstance(Class[] classesToBeBound, Map<String,?> properties)
19newInstance(String contextPath)
20newInstance(String contextPath, ClassLoader classLoader)
21newInstance(String contextPath, ClassLoader classLoader, Map<String,?> properties)