Skip to Content
avatar image
Former Member

sapxmltoolkit

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Mar 03, 2004 at 01:54 PM

    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 sapxmltoolkit library (provider is sap.com).

    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

    Add comment
    10|10000 characters needed characters exceeded