Chapter 5Configuring an XML Resolver

The XML Resolver is available for both Java and .NET. By and large, it works the same way in both environments and has similar features. One area where differences are unavoidable is in configuration because Java and .NET expose different mechanisms.

The Java XML Resolver classes use either Java system properties or a standard Java properties file to establish an initial environment.

On .NET, environment variables are used instead of system properties and the properties file is a standard .NET configuration file.

1Configuring XML Resolver on Java

On Java, the resolver searches for a property file by looking in the following places, in this order:

  • The location identified by the system property.

  • The location identified by the XMLRESOLVER_PROPERTIES environment variable.

  • A file named on your classpath.

1.1Example file

An file might look like this:

 1 |#
 5 |# Always use semicolons in this list
10 |allow-oasis-xml-catalog-pi=no

2Configuring XML Resolver on .NET

On .NET, the resolver uses the enviornment variable XMLRESOLVER_APPSETTINGS to locate .NET properties file. The properties file can be either XML (in an XmlResolver section) or JSON (in an XmlResolver object).

2.1Example xmlresolver.config file

An xmlresolver.config file might look like this:

1 |<configuration>
  |  <xmlResolver relativeCatalogs="no"
  |               catalogs="./catalog.xml;/Users/userid/Documents/catalog.xml"
  |               prefer="public"
5 |               allowOasisXmlCatalogPi="yes"
  |               cache="/Users/userid/Library/Caches/"
  |               cacheUnderHome="false"
  |               preferPropertyFile="no"/>

If JSON is more convenient, it might look like this:

 1 |{
   |  "XmlResolver": {
   |    "preferPublic": true,
   |    "relativeCatalogs": "false",
 5 |    "catalogs": "./catalog.xml;/Users/userid/Documents/catalog.xml",
   |    "prefer": "public",
   |    "allowOasisXmlCatalogPi": "yes",
   |    "cache": "/Users/userid/Library/Caches/",
   |    "cacheUnderHome": "false",
10 |    "preferPropertyFile": "no"
   |  }