WebLogic provides extensive support for XML and XML-related APIs. Not surprisingly, it comes equipped with modern SAX and DOM parsers based on Apache's Xerces 2.1.0, and an XSLT transformer based on the Xalan 2.2 libraries that is shipped with the JDK 1.4.1 distribution. It also is shipped with a FastParser, which is a high-performance nonvalidating SAX parser. WebLogic's FastParser is optimized for small to medium-size documents, typical of a lot of SOAP and WSDL documents.
WebLogic implements the standard JAXP 1.1 layer, which provides a generic way to access any parser or transformer. Its XML Registry integrates with the JAXP implementation. This allows you to override the built-in parsers and transformers and specify alternative implementations that should be used under different circumstances. For example, you can set up different parsers to be based on the root element or document type information. These XML Registries can be configured on a per-server basis, giving you good control of what XML parsers should be used when. Of course, all these adjustments can be made without changing a single line of Java code.
XML documents often contain references to external entities. External entities, such as DTDs, are pieces of text external to the document being parsed. An XML Registry can be used to configure local mappings for these DTDs. If this is done, WebLogic can bypass a potentially time-consuming fetch for the DTD whenever XML data needs to be parsed. The registry also has a configurable cache, which can be used on the results of external entity resolution.
WebLogic's Streaming API offers a parsing paradigm very different from either the DOM or SAX models. Like the SAX model, the program views an XML document as a number of parser events that signify important structural elements within the document. Unlike SAX, the Streaming API supports a pull model for parsing XML data, whereby the program must explicitly extract XML events from the stream.
The Streaming API lets you iterate over the stream, pulling off events and processing the XML data depending on the events you encounter. You also can skip ahead over a number of XML events, or just ignore them altogether. You even can apply a filter to the XML stream to ensure that only specific events are allowed through the filter. Finally, you can use the Streaming API to generate XML data and direct this output to various destinations.
WebLogic also provides an XPath API that lets you match XPath queries against a DOM or an XML input stream. WebLogic supports two convenience features as well: a JSP tag library that provides easy access to XSL transformers from within a JSP page, and special-purpose servlet request attributes that automatically can parse the message body of an incoming request.
Finally, WebLogic provides a standalone, Java-based XML editor, which is a simple tool for creating and editing XML documents. It supports both a plain-text view and a tree view of an XML document. The XML Editor also lets you validate a document against a DTD or an XML Schema. WebLogic's JMS implementation includes support for a new type of message that can hold XML data. This is covered in Chapter 8.
BEA has created other XML technologies, not exclusively for use in WebLogic Server, which also deserve a mention. This includes a Streaming API for XML implementation, and XMLBeans, which is an XML Schema to Java Object mapping tool. You can learn more about these from BEA's dev2dev web site.