Configuration using XQJ

The root object in the XQJ (XQuery for Java) API is javax.xml.query.XQDataSource, and the Saxon implementation class is com.saxonica.xqj.SaxonXQDataSource. The XQDataSource provides methods getProperty(name) and setProperty(name, value) which at first sight appear to map cleanly to the methods getConfigurationProperty(name) and setConfigurationProperty(name, value) in the underlying Saxon Configuration, and indeed they can be used in this way, using either the URI value of the property or the symbolic constant in class net.sf.saxon.lib.FeatureKeys.

There are some glitches, however. Firstly, the XQJ specifications mandate that the properties available through this interface should also have explicit getters and setters: for example if a property named "lineNumbering" is available, then there should be a pair of methods setLineNumbering() and getLineNumbering(). This does not square well with the use of URIs for property names. Secondly, XQJ requires that the property values should be strings. Saxon therefore:

  1. exposes a subset of commonly-used configuration properties using shortened names such as dtdValidation and retainLineNumbers

  2. provides getters and setters for these properties, as required by the XQJ specification

  3. lists the names of the above properties (only) in the result of the method getSupportedPropertyNames()

  4. makes all other configuration properties available using URIs as the name, without providing getters and setters, and without listing the names in the result of getSupportedPropertyNames(), provided that the value can be represented as a string. Boolean values can be represented using any of the strings ("yes", "on", "true", or "1"), or ("no", "off", "false", or "0").