bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

WebLogic Server Frequently Asked Questions

FAQs: XML

- Which XML parser comes with WebLogic Server 7.0?

- Is an XSLT processor bundled in WebLogic Server?

- What version of the JAXP API specification is implemented in WebLogic Server 7.0?

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

- Can I plug in a version of Apache's Xerces XML parser that is different to the one that is built-in with WebLogic Server 7.0 (Xerces 1.4.4)?

- I plugged in a version of Apache Xalan that I downloaded from the Apache Web site, and now I get errors when I try to transform documents. What is the problem?

- How do I identify the document type of an XML document?

Q. Which XML parser comes with WebLogic Server 7.0?

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

- a built-in parser based on Apache's Xerces 1.4.4 parser

- WebLogic FastParser, a high-performance non-validating parser that you can use for small to medium sized XML documents.

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 an XSLT processor bundled in WebLogic Server?

A. Yes, we bundle an XSLT processor, based on Apache's Xalan 2.2 processor, in WebLogic Server 7.0.

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

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. Can I plug in a version of Apache's Xerces XML parser that is different to the one that is built-in with WebLogic Server 7.0 (Xerces 1.4.4)?

A. Yes. The version of Xerces that you can plug in, depends on the specific service pack of WebLogic Server 7.0 that you have installed.

If you have installed WebLogic Server 7.0.0.1 or lower on your computer, follow these instructions:

You can plug in the following versions of Xerces:

- Xerces 1.2.2

- Xerces 1.2.3

- Xerces 1.3.0

- Xerces 1.3.1

- Xerces 1.4.0

- Xerces 2.0.0

- Xerces 2.0.1

Warning: If you plug in version 2.0.0 or higher of Xerces, you cannot use the Xalan compatibility classes.

To plug in a different version of the Apache Xerces parser, follow these steps:

1. Append the xerces.jar file to the end of WebLogic Server's CLASSPATH variable. This variable is set, by default, in the WL_HOME/server/bin/startWLS.cmd script used to start instances of WebLogic Server, where WL_HOME refers to the top-level directory of the WebLogic Platform.

   You can also put the xerces.jar file in the WEB-INF/lib directory of the WAR file of your application. In this case, be sure you do not enable the PreferWebInfClasses flag for your Web application.

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

If you have installed WebLogic Server 7.0 Service Pack 1 on your computer, follow these instructions:

You can plug in any version of the Xerces XML parser.

To plug in a different verison of the Xerces parser, follow these steps:

1. Put the xerces.jar file in the WEB-INF/lib directory of your application. Be sure you enable the PreferWebInfClasses flag for your Web application.

2. Configure the parser and builder factories through files in the META-INF/services directory in one of the archives in WEB-INF/lib if they are not already present in the xerces.jar file.

Warning: If you plug in a new version of Xerces using this procedure, you cannot use Administratin Console to configure the XML registry to configure the parser or entity resolution. If you need to configure the XML registry, use the procedure for plugging in new parsers for version 7.0.0.1 or lower described in the beginning of this section.

Q. I plugged in a version of Apache Xalan that I downloaded from the Apache Web site, and now I get errors when I try to transform documents. What is the problem?

A. You must ensure that the version of Apache Xalan you download from the Apache Web site is compatible with the version of Apache Xerces you are using with WebLogic Server. This version is either the built-in version of 1.4.4 or one of the versions listed in the preceding question if you have plugged in your own version of Xerces.

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: 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.