Administration Console Online Help

Previous Next Open TOC in new window
Content starts here

Associate a parser to a document type

Before you begin

Create an XML registry and associate it with your WebLogic Server instance. For details, see Create an XML registry.


Configuring a parser for a particular document type means that whenever WebLogic Server parses an XML document of that type, it uses the parser you specify, rather than the default WebLogic Server parser. You use the document system ID, public ID, or root element name to identify the document type. For simplicity, the following procedure uses the term parser select entry to specify an entry in an XML registry that associates a parser with a specific XML document type.

Note: WebLogic Server searches only the first 1000 bytes of an XML document when attempting to identify its document type. If it does not find a DOCTYPE identifier in those first 1000 bytes, it stops searching the document and uses the default parser configured for the WebLogic Server instance to parse the document.

The procedure for this task uses the following XML file:

<?xml version="1.0"?> 
<!-- This XML document describes a car --> 
<!DOCTYPE CAR PUBLIC "-//Oracle//DTD for cars//EN" "http://www.oracle.com/dtds/car.dtd">
<CAR> 
   <MAKE>Toyota</MAKE> 
   <MODEL>Corrolla</MODEL> 
   <YEAR>1998</YEAR> 
   <ENGINE>1.5L</ENGINE> 
   <HP>149</HP> 
</CAR>

To configure a parser select entry:

  1. If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit (see Use the Change Center).
  2. In the left pane, expand Services and select XML Registries.
  3. In the XML Registries table, click on the XML registry for which you want to create a parser select entry.
  4. In the Settings for XMLRegistryName page, select Contents > Parser Select Entries.
  5. Click New.
  6. Enter the public ID of the XML document in the Public ID field. For example, in the sample XML document listed at the top of this page, the public id is -//Oracle//DTD for cars//EN.
  7. Optionally, enter the system ID of the XML document in the System ID field. In the sample XML document, the system id is http://www.oracle.com/dtds/car.dtd.
  8. Enter the name of the root element of the XML document in the Root Element Name field. In the sample XML document, the root element is CAR. If your XML document defines a namespace, be sure to enter the fully qualified root element name, such as VEHICLES:CAR.
  9. Enter the full name of the class that implements the javax.xml.parsers.DocumentBuilderFactory interface (for DOM processing) and javax.xml.parsers.SaxParserFactory (for SAX processing) in the Document Builder Factory or Sax Parser Factory fields, respectively. WebLogic Server will use these classes when getting a parser to parse XML documents of the specified type.

    Note: Do not enter any information in the Parser Class Name field; this field is for backward compatibility with previous versions of WebLogic Server only.

  10. Click OK.
  11. To activate these changes, in the Change Center of the Administration Console, click Activate Changes.
    Not all changes take effect immediately—some require a restart (see Use the Change Center).

Back to Top