Skip Headers
Oracle® Containers for J2EE Configuration and Administration Guide
10g (10.1.3.1.0)

Part Number B28950-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

14 Registering DTDs and XSDs with OC4J

This chapter describes the process for registering new entities - specifically any vendor-specific DTDs and XSDs used to define the format of XML deployment descriptors - within OC4J, which is required if XML file validation will be performed. It contains the following topics:

Why XSDs Have to Be Registered

OC4J provides the ability to validate XML deployment descriptors defined by an XSD at the time the files are read. This feature is enabled by passing the -validateXML argument on the oc4j.jar command line at OC4J startup. See Chapter 4, "OC4J Runtime Configuration" for details on command-line options.

Validation requires that the XSD defining an XML document be registered with the OC4J server. If this entity is not registered, XML validation may not occur.

When an XML document is read, the parser passes one or more keys identifying the XSD declared in the document to an OC4J component known as the Entity Resolver. The Entity Resolver resolves the location of the registered entity and returns it to the parser, enabling the XML document to be validated.

Two types of keys are used to reference an entity: A public identifier and a system identifier, both of which are declared in the XML document

To enable the Entity Resolver to locate the entity, one or both of these identifiers must be registered with OC4J through entries in the entity-resolver-config.xml file. The entity's location must also be specified in this file.

By default, entity-resolver-config.xml already contains registration entries for the standard J2EE XSDs as well as for all OC4J-specific XSDs. As such, you are only required to add entries for non-J2EE or non-OC4J entities.

Registering a DTD or XSD

To register a DTD or XSD with OC4J, you must add it to the entity-resolver-config.xml file, which is located in the ORACLE_HOME/j2ee/instance/config directory on the OC4J host machine.

Each entity is declared in an <entity> element, which includes the following subelements:

The following <entity> element will register acme-web.dtd with OC4J. Both the public and system identifiers, which are declared in the <!DOCTYPE> element within an XML document, are registered.

<entity>
  <description>acme-web-2_0.dtd</description>
  <public-id>-//Acme//Acme web Descriptor 2.0//EN</public-id>
  <system-id>http://xmlns.acme.com/dtd/acme-web-2_0.dtd</system-id>
  <location>META-INF/acme-web-2_0.dtd</location>
</entity>

The next example will register acme-application.xsd with OC4J. The system identifier is declared in either the xsi:schemaLocation or the xsi:noNamespaceSchemaLocation attributes of the root element within an XML document.

<entity>
  <description>acme-application-1_0.xsd</description>
  <public-id />
  <system-id>http://xmlns.acme.com/schema/acme-application-1_0.xsd</system-id>
  <location>META-INF/acme-application-1_0.xsd</location>
</entity>


Note:

The OC4J server must be restarted after you make changes to entity-resolver-config.xml.