<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="configuration" page="config-interfaces" subpage="config-xqj"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Configuration using XQJ</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Configuration using XQJ"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Configuration using XQJ</h1>
      <p>The root object in the XQJ (XQuery for Java) API is <code>javax.xml.query.XQDataSource</code>, and the Saxon
            implementation class is <a class="bodylink" href="../../javadoc/net/sf/saxon/xqj/SaxonXQDataSource.html"><code>net.sf.saxon.xqj.SaxonXQDataSource</code></a>. 
            The <code>XQDataSource</code> provides
         methods <code>getProperty(name)</code> and <code>setProperty(name, value)</code> which at first sight appear to map
         cleanly to the methods <code>getConfigurationProperty(name)</code> and <code>setConfigurationProperty(name, value)</code>
         in the underlying Saxon <a class="bodylink" href="../../javadoc/net/sf/saxon/Configuration.html"><code>Configuration</code></a>, and indeed they can be used in this way, 
            using either the URI value of the
         property or the symbolic constant in class <a class="bodylink" href="../../javadoc/net/sf/saxon/lib/FeatureKeys.html"><code>net.sf.saxon.lib.FeatureKeys</code></a>.</p>
      <p>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 <code>setLineNumbering()</code> and <code>getLineNumbering()</code>. 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:</p>
      <ol>
         <li content="para">
            <p>exposes a subset of commonly-used configuration properties using shortened names such as
         <code>dtdValidation</code> and <code>retainLineNumbers</code>;</p>
         </li>
         <li content="para">
            <p>provides getters and setters for these properties, as required by the XQJ specification;</p>
         </li>
         <li content="para">
            <p>lists the names of the above properties (only) in the result of the method <code>getSupportedPropertyNames()</code></p>
         </li>
         <li content="para">
            <p>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 <code>getSupportedPropertyNames</code>, 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").</p>
         </li>
      </ol>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="config-ant.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>