![]() |
![]() |
|
The following sections describe XML administration with WebLogic Server:
For additional information about using the XML Registry to configure WebLogic Server for XML applications, see the Administration Guide and the Administration Console Online Help.
Introduction to XML Administration
You use the XML Registry, which is accessed through the Administration Console, to configure WebLogic Server for XML applications.
By default, WebLogic Server is configured to use the built-in parser to parse XML documents. As long as you use the default configuration, you do not have to perform any configuration tasks for your XML applications. If you want to use a parser or parsers other than the built-in parser, you must use the XML Registry to configure them.
Note: To use the XML Registry to configure WebLogic Server for an XML application, you must use the Java API for XML Parsing (JAXP). If you use a parser through the parser's own proprietary API, the XML Registry has no effect on the behavior of your XML application.
You create, configure, and use the XML Registry through the Administration Console. You can configure as many XML Registries in a domain as there are servers in a domain, but you can only configure one XML Registry or zero for a particular server.
The benefits of using the Administration Console XML Registry are as follows:
You can use the XML Registry to specify the following:
All of the above capabilities are automatically enabled if your application uses the standard Java API for XML Parsing (JAXP), which is included in this version of WebLogic Server. These capabilities are for use on the server side only.
Use the Administration Console to access and edit contents of the XML Registry. Figure 3-1 shows an example of an XML Registry configured through the Administration Console.
Figure 3-1 Sample XML Registry Code Displayed in Administration Console
Relationship Between JAXP and the XML Registry
The XML registry is automatically consulted whenever you use the JAXP API to write your XML applications. The WebLogic Server JAXP implementation can inspect the content of the XML document and delegate to an appropriate parser based on the XML Registry configuration. If no parser is registered for the document type, the JAXP implementation delegates to the default parsers specified in the XML Registry. If no default parsers are registered, the built-in parser is registered for the document type. Additionally, when WebLogic Server starts, a SAX entity resolver is automatically set so that it can resolve entities that are declared in the registry. As a result, users are not required to modify their XML application code to control the parsers used, or to set the location of local copies of external entities. All of this is controlled by the XML Registry.
Note: If you elect to use an API provided by a parser instead of the JAXP API, the XML Registry has no effect on the processing of XML documents.
XML Registry Configuration Tasks
You can use the XML Registry to perform the following tasks:
In this configuration, WebLogic Server uses parsers other than the built-in parser. For example, you can configure WebLogic Server to use the bundled version of the Apache Xerces parser, the Sun parser, and other available parsers.
In this configuration, WebLogic Server uses custom parsers generated using the WebLogic Parser Generator.
In this configuration, WebLogic Server uses local copies of external entities for entity resolution.
WebLogic Server uses the built-in parser to parse XML documents by default. You do not have to perform any configuration tasks. You simply write and build your XML application using the JAXP API.
Configuring a Parser Other Than the Built-In Parser
To use a parser other than the built-in parser, use the following procedure:
Figure 3-2 XML Registries Create Window
For example, to use the Sun parser, enter the following in the XML Registries>Create window (see Figure 3-3):
Name: Sun Parser Registry
DocumentBuilderFactory: com.sun.xml.parser.DocumentBuilderFactoryImpl
SAXParserFactory: com.sun.xml.parser.SAXParserFactoryImpl
To use the bundled Apache Xerces parser from the XML Module, enter the following in the XML Registries>Create window.
Name: Xerces parer Registry
DocumentBuilderFactory: "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
SAXParserFactory: "org.apache.xerces.jaxp.SAXParserFactoryImpl"
Figure 3-3 Configured Sun Parser Registry
Figure 3-4 Servers Table Window
Figure 3-5 Server Configuration Window
Figure 3-6 XML Registry Folder Window
Configuring a Custom-Generated Parser
You can generate a custom parser based on a specific DTD. For instructions about how to generate a custom parser, see Using the WebLogic Parser Generator to Generate Custom Parsers.
To use a generated parser to parse XML documents based on a particular DTD, perform the following steps:
Figure 3-7 XML Registries Generated Parser Registry Window
Figure 3-8 XML Registry Entries Window
Figure 3-9 XML Registries Create Window
Listing 3-1 car.xml File
<?xml version="1.0"?>
<!-- This XML document describes a car -->
<!DOCTYPE CAR PUBLIC "-//BEA Systems, Inc.//DTD for cars//EN"
"http://dev/null">
<CAR>
<MAKE>Toyota</MAKE>
<MODEL>Corrolla</MODEL>
<YEAR>1998</YEAR>
<ENGINE>1.5L</ENGINE>
<HP>149</HP>
</CAR>
Note: Using URLs is not desirable because both reliability and performance may suffer.
Configuring Local Entity Resolution
You can use the XML Registry to define local copies of external entities. These entities can then be copied to a local area for resolution so that WebLogic Server does not have to access a remote Web site to resolve them.
To configure local entity resolution, perform the following steps:
Figure 3-10 XML Registry Entries Create Window for Entity Resolution
c:/BEA Home/wlserver6.0/config/examples/xml/registries/reg_name
in the domain configuration directory, where BEA Home is the top-level directory
in which the WebLogic Server software is installed. The reg_name is the name of
the new XML Registry. For example, for the car.dtd, enter dtd/car.dtd in the
Entity Path field.
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|