on 2004 Mar 01 3:13 PM
Hello,
I have read that the WebAS XML parser (SapXmlToolkit) is a DOM-based parser. Is that true? How can I set the XML parser in WebAS, e.g. exchange it with an SAX based parser?
regards, maik
Hi Maik,
SAPXMLToolkit provides JAXP 1.2 implementation including DOM and SAX Parsing, XSL Transformation. Also it provides schema validation and XPath usage.
Inside the WebAS, the sapxmltoolkit is provided as a separate library. In order to use it you have to register a reference from your component(application, service, etc.) to the <i>sapxmltoolkit</i> library (provider is <i>sap.com</i>).
You can create an instance of the SAXParserFactory using the standard JAXP way:
ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
SAXParserFactory factory;
try {
Thread.currentThread().setContextClassLoader(
this.getClass().getClassLoader());
factory = SAXParserFactory.newInstance();
} finally {
Thread.currentThread().setContextClassLoader(oldLoader);
}
Since JAXP 1.1.3 (or newer versions) Sun changed the way of loading the implementation in a way that it is loaded by the context classloader. One of the reasons for this change is that in JDK 1.4, the JAXP interfaces are loaded by the system class loader. That's why every user needs to preset the context classloader to the one that contains or references the JAXP implementation.
Note: Do not set any JAXP System properties inside the WebAS due to this does not work in a multi-threaded environment such as the J2EE Engine.
Hope this helps
Best regards,
Alexander
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
57 | |
11 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.