Configuring 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.

Configuring 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 xmlresolver.properties system property.

  • The location identified by the XMLRESOLVER_PROPERTIES environment variable.

  • A file named xmlresolver.properties on your classpath.

Example xmlresolver.properties file

An xmlresolver.properties file might look like this:

1# xmlresolver.properties
 
relative-catalogs=yes
 
5# Always use semicolons in this list
catalogs=./catalog.xml;/Users/ndw/Documents/catalog.xml
 
prefer=public
cache=/Users/ndw/Library/Caches/xmlresolver.org/cache
10allow-oasis-xml-catalog-pi=no
prefer-property-file=false

Configuring 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).

Example 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/xmlresolver.org/cache"
               cacheUnderHome="false"
               preferPropertyFile="no"/>
</configuration>

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/xmlresolver.org/cache",
    "cacheUnderHome": "false",
10    "preferPropertyFile": "no"
  }
}