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
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.
(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.
No. |
API type |
Class name |
Method name |
---|---|---|---|
1 |
JAXP API |
javax.xml.datatype.DatatypeFactory |
newInstance() |
2 |
javax.xml.parsers.DocumentBuilderFactory |
newInstance() |
|
3 |
javax.xml.parsers.SAXParserFactory |
newInstance() |
|
4 |
javax.xml.transform.TransformerFactory |
newInstance() |
|
5 |
javax.xml.transform.sax.SAXTransformerFactory |
newInstance() |
|
6 |
javax.xml.validation.SchemaFactory |
newInstance(String schemaLanguage) |
|
7 |
javax.xml.xpath.XPathFactory |
newInstance() |
|
8 |
newInstance(String URI) |
||
9 |
org.w3c.dom.bootstrap.DOMImplementationRegistry |
newInstance() |
|
10 |
org.xml.sax.helpers.XMLReaderFactory |
createXMLReader() |
|
11 |
StAX API |
javax.xml.stream.XMLInputFactory |
newInstance() |
12 |
newFactory() |
||
13 |
javax.xml.stream.XMLOutputFactory |
newInstance() |
|
14 |
newFactory() |
||
15 |
javax.xml.stream.XMLEventFactory |
newInstance() |
|
16 |
newFactory() |
||
17 |
JAXB API |
javax.xml.bind.JAXBContext |
newInstance(Class... classesToBeBound) |
18 |
newInstance(Class[] classesToBeBound, Map<String,?> properties) |
||
19 |
newInstance(String contextPath) |
||
20 |
newInstance(String contextPath, ClassLoader classLoader) |
||
21 |
newInstance(String contextPath, ClassLoader classLoader, Map<String,?> properties) |