FAQs: XML


Q. Which XML parser comes with WebLogic Server 8.1?

A. We bundle the following two parsers with WebLogic Server 8.1:

    The WebLogic XML Registry allows you to configure the parser you want to use for specific document types.

    You can also use the WebLogic XML Streaming API to parse your XML documents. The Streaming API is based on the SAX API, but provides a more procedural, stream-based handling of XML documents rather than having to write SAX event handlers, which can get complicated when dealing with complex XML documents.


Q. Is there an XSLT processor included in WebLogic Server 8.1?

A. Yes, the one that ships in the JDK 1.4.1_02: Apache's Xalan 2.2D11. This is the built-in XSLT processor for WebLogic Server 8.1.


Q. Can I upgrade the built-in XML parser (based on Apache's Xerces 2.1.0) to a later Xerces version?

A. Yes. To upgrade to version 2.2.0, 2.3.0, or 2.4.0 of Apache's Xerces, follow these steps:

  1. Append the appropriate Apache xercesImpl.jar file to the end of WebLogic Server's CLASSPATH variable. The CLASSPATH variable is typically set in the scripts used to start WebLogic Server. The xercesImpl.jar file contains Apache's implementation of the version of Xerces to which you want to upgrade.

    You can also put the xercesImpl.jar file in the WEB-INF/lib directory of the WAR file of your application. You do not need to enable the PreferWebInfClasses flag for your Web application.

    Warning: Do not use the archives from Apache named xml-apis.jar or xmlParserAPIs.jar.

  2. Configure your XML Registry to use org.apache.xerces.jaxp for the DocumentBuilderFactory or SAXParserFactory factories. For details, see Administering WebLogic Server XML.

Q. Can I upgrade the built-in XSLT processor (based on Apache's Xalan 2.2D11) to a later Xalan version?

A. Yes. For instructions, see Endorsed Standards Override Mechanism.

The version of Xalan to which you upgrade will be used from any user application code that gets a transformer through JAXP. WebLogic Server itself uses this transformer when processing Web Service attachments and for the JSP XSLT tag library.

Q. What version of the JAXP API specification is implemented in WebLogic Server 8.1?

A. Version 1.1. This version includes pluggable XML transformation as well as pluggable XML parsing.


Q. Can I use the getAttribute() and setAttribute() methods of Version 2.3 of the Java Servlet API to parse XML documents?

A. Yes. Use the setAttribute() method for SAX mode parsing and the getAttribute() method for DOM mode parsing. Using these methods in a Servlet, however, is a WebLogic-specific feature. This means that the Servlet may not be fully portable to other Servlet engines, so use the feature with caution.


Q. How do I identify the document type of an XML document?

A. If the XML document has a Public ID, then that is its document type. For example, if an XML document contains the following DOCTYPE declaration:

<!DOCTYPE mydoc PUBLIC "My public ID String" 


            "http://foo.com/url/to/my/dtd">

then its document type is My public ID String.

If the DOCTYPE declaration does not contain a Public ID, but specifies a System ID, then the document type is the System ID. For example, in the following DOCTYPE declaration:

<!DOCTYPE mydoc SYSTEM "http://foo.com/url/to/my/dtd">

the document type is http://foo.com/url/to/my/dtd. Note that the System ID is of the DTD, not of the XML document itself. It can, however, still be used as a way to identify the XML document.

If the XML document does not specify a DOCTYPE declaration, then the document type can be either the root element name or the namespace URI, if it has one.


Q. I get a java.lang.LinkageError exception when I use Ant to run a client application that uses the WebLogic JAXP implementation. What is the problem?

A. The problem might have to do with Ant classloading. The workaround is to fork the VM by setting the fork="true" attribute of the java Ant task while running the application.

The full text of the error is as follows:

[java] java.lang.LinkageError: loader constraints violated when linking org /xml/sax/InputSource class 



[java] at weblogic.xml.jaxp.RegistryDocumentBuilderFactory.newDocumentBuilder(RegistryDocumentBuilderFactory.java:128)

Back to Top Previous Next