5.1.9 XML Entity Resolver

All XML services have an entity resolver that allows the parser to locate resources that are external to the document.

The entity resolver can be used to cache external resource files on the local machine, so the service does not need to use the HTTP protocol to get remote resource files. This technique can also be used to handle proxy/firewall issues where the service cannot connect to the remote server.

Refer to xml.apache.org/commons/components/resolver/resolver-article.html

A resource lookup hierarchy is used to determine the location of dtd and schema files.

If a systemid.{url}property exists then it will be used.

The following steps are done for file (non-http) resources.

If the 'schema.dir' property exists, then this directory value and the url resource filename are used to determine the location of the file.

If the 'schema.dir' property does not exist and the url resource path does exist, then the url resource path is used.

If the 'schema.dir' property does not exist and the url resource path does not exist, then the instance dtd sub-directory and the url resource filename is used.

Here is an example of an XML document that will use the entity resolver to locate the external resource 'order.dtd'.

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE Orders SYSTEM "order.dtd">

<Orders>

</Orders>

 

Sample XML service properties entries

 

schema.dir=schema

 

systemid.file:///jsm/instance/order.dtd=dtd/order.dtd

systemid.file:///jsm/instance/shipment.xsd=dtd/shipment.xsd

systemid.http://nasdaq.com/reference/NasdaqDotCom.dtd=dtd/nasdaq.dtd

systemid.file:///C:/Program%20Files/LANSA/Integrator/JSMInstance/order.dtd=dtd/order.dtd

 

Note: The %20 represents a blank.