Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.xqj
Class SaxonXQDataSource

    java.lang.Object
      net.sf.saxon.xqj.SaxonXQDataSource

All Implemented Interfaces:
  javax.xml.xquery.XQDataSource

    public class SaxonXQDataSource

extends java.lang.Object
implements javax.xml.xquery.XQDataSource

Saxon implementation of the XQJ XQDataSource interface. The first action of a client application is to instantiate a SaxonXQDataSource. This is done directly: there is no factory class as with JAXP. An application that does not want compile-time references to the Saxon XQJ implementation can instantiate this class dynamically using the reflection API (class.newInstance()).

For full Javadoc descriptions of the public methods, see the XQJ specification.

Constructor Summary
`SaxonXQDataSource()` Create a SaxonXQDataSource using a default configuration.
`SaxonXQDataSource(Configuration config)` Create a Saxon XQDataSource with a specific configuration

Method Summary
`java.lang.String` | `getAllowExternalFunctions()` Ask whether queries are allowed to call external functions.
`Configuration` | `getConfiguration()` Get the Saxon Configuration in use.
`javax.xml.xquery.XQConnection` | `getConnection()` Attempts to create a connection to an XML datasource.
`javax.xml.xquery.XQConnection` | `getConnection(java.sql.Connection con)` Get a connection based on an underlying JDBC connection
`javax.xml.xquery.XQConnection` | `getConnection(java.lang.String username, java.lang.String password)` Get a connection, by supplying a username and password.
`java.lang.String` | `getDtdValidation()` Ask whether source documents are to be parsed with DTD validation enabled
`java.lang.String` | `getExpandAttributeDefaults()` Ask whether fixed or default values defined in a schema or DTD will be expanded
`java.lang.String` | `getExpandXInclude()` Ask whether XInclude processing is to be applied to source documents
`int` | `getLoginTimeout()` Gets the maximum time in seconds that this datasource can wait while attempting to connect to a database.
`java.io.PrintWriter` | `getLogWriter()` Retrieves the log writer for this `XQDataSource` object.
`java.lang.String` | `getProperty(java.lang.String name)` Get a configuration property setting.
`java.lang.String` | `getRetainLineNumbers()` Ask whether line and column information will be retained for source documents
`java.lang.String` | `getSchemaValidationMode()` Ask whether source documents will be validated against a schema
`java.lang.String` | `getStripWhitespace()` Ask whether whitespace will be stripped when loading source documents
`java.lang.String[]` | `getSupportedPropertyNames()` Returns an array containing the property names supported by this `XQDataSource`.
`java.lang.String` | `getUseXsiSchemaLocation()` Ask whether the schema processor is to take account of xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes encountered in an instance document being validated
`java.lang.String` | `getXmlVersion()` Ask whether XML 1.0 or XML 1.1 rules for XML names are to be followed
`java.lang.String` | `getXsdVersion()` Ask whether XML Schema 1.0 syntax must be used or whether XML Schema 1.1 features are allowed
`void` | `setAllowExternalFunctions(java.lang.String value)` Say whether queries are allowed to call external functions.
`void` | `setDtdValidation(java.lang.String value)` Say whether source documents are to be parsed with DTD validation enabled
`void` | `setExpandAttributeDefaults(java.lang.String value)` Say whether whether fixed and default values defined in a schema or DTD will be expanded.
`void` | `setExpandXInclude(java.lang.String value)` Say whether XInclude processing is to be applied to source documents
`void` | `setLoginTimeout(int seconds)` Sets the maximum time in seconds that this datasource will wait while attempting to connect to a database.
`void` | `setLogWriter(java.io.PrintWriter out)` Sets the log writer for this `XQDataSource` object to the given `java.io.PrintWriter` object.
`void` | `setProperties(java.util.Properties props)` Sets the data source properties from the specified `Properties` instance.
`void` | `setProperty(java.lang.String name, java.lang.String value)` Set a configuration property.
`void` | `setRetainLineNumbers(java.lang.String value)` Say whether source documents should have line and column information retained.
`void` | `setSchemaValidationMode(java.lang.String value)` Say whether source documents should be validated against a schema
`void` | `setStripWhitespace(java.lang.String value)` Say whether whitespace should be stripped when loading source documents
`void` | `setUseXsiSchemaLocation(java.lang.String value)` Say whether the schema processor is to take account of xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes encountered in an instance document being validated
`void` | `setXmlVersion(java.lang.String value)` Say whether XML 1.0 or XML 1.1 rules for XML names are to be followed
`void` | `setXsdVersion(java.lang.String value)` Say whether XML Schema 1.0 syntax must be used or whether XML Schema 1.1 features are allowed

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SaxonXQDataSource

    public SaxonXQDataSource()

  Create a SaxonXQDataSource using a default configuration. A schema-aware configuration will be created if Saxon-SA can be loaded from the classpath; otherwise a basic (non-schema-aware) configuration is created

### SaxonXQDataSource

    public SaxonXQDataSource(Configuration config)

  Create a Saxon XQDataSource with a specific configuration

  Parameters:
    `config` - The Saxon configuration to be used

Method Detail

### getConfiguration

    public Configuration getConfiguration()

  Get the Saxon Configuration in use. Changes made to this Configuration will affect this data source and XQJ connections created from it (either before or afterwards). Equally, changes made to this SaxonXQDataSource are reflected in the Configuration object (which means they also impact any other SaxonXQDataSource objects that share the same Configuration).

  Returns:
    the configuration in use.

### getConnection

    public javax.xml.xquery.XQConnection getConnection()
                                                throws javax.xml.xquery.XQException

  Description copied from interface: `javax.xml.xquery.XQDataSource`
  Attempts to create a connection to an XML datasource.

  Specified by:
    `getConnection` in interface `javax.xml.xquery.XQDataSource`
  Returns:
    a connection to the XML datasource
  Throws:
    `javax.xml.xquery.XQException` - if a datasource access error occurs

### getConnection

    public javax.xml.xquery.XQConnection getConnection(java.sql.Connection con)
                                                throws javax.xml.xquery.XQException

  Get a connection based on an underlying JDBC connection

  Specified by:
    `getConnection` in interface `javax.xml.xquery.XQDataSource`
  Parameters:
    `con` - the JDBC connection
  Returns:
    a connection based on an underlying JDBC connection
  Throws:
    `javax.xml.xquery.XQException` - The Saxon implementation of this method always throws an XQException, indicating that Saxon does not support connection to a JDBC data source.

### getConnection

    public javax.xml.xquery.XQConnection getConnection(java.lang.String username,
                                                       java.lang.String password)
                                                throws javax.xml.xquery.XQException

  Get a connection, by supplying a username and password. The Saxon implementation of this is equivalent to the default constructor: the username and password are ignored.

  Specified by:
    `getConnection` in interface `javax.xml.xquery.XQDataSource`
  Parameters:
    `username` - the user name
    `password` - the password
  Returns:
    a connection
  Throws:
    `javax.xml.xquery.XQException`

### getLoginTimeout

    public int getLoginTimeout()

  Description copied from interface: `javax.xml.xquery.XQDataSource`
  Gets the maximum time in seconds that this datasource can wait while attempting to connect to a database. A value of zero means that the timeout is the default system timeout if there is one; otherwise, it means that there is no timeout. When a XQDataSource object is created, the login timeout is initially zero. It is implementation-defined whether the returned login timeout is actually used by the data source implementation.

  Specified by:
    `getLoginTimeout` in interface `javax.xml.xquery.XQDataSource`
  Returns:
    the datasource login time limit

### getLogWriter

    public java.io.PrintWriter getLogWriter()

  Description copied from interface: `javax.xml.xquery.XQDataSource`
  Retrieves the log writer for this `XQDataSource` object. The log writer is a character output stream to which all logging and tracing messages for this datasource will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. When a `XQDataSource` object is created, the log writer is initially `null`; in other words, the default is for logging to be disabled.

  Specified by:
    `getLogWriter` in interface `javax.xml.xquery.XQDataSource`
  Returns:
    the log writer for this datasource or `null` if logging is disabled

### getProperty

    public java.lang.String getProperty(java.lang.String name)
                                 throws javax.xml.xquery.XQException

  Get a configuration property setting. The properties that are supported, and their meanings, are the same as the properties that can be obtained using "get" methods; for example `getProperty("dtdValidation")` returns the same result as `getDtdValidation()`.

  Further Saxon configuration properties are available via the Saxon `Configuration` object, which can be obtained using the `getConfiguration()` method.

  Specified by:
    `getProperty` in interface `javax.xml.xquery.XQDataSource`
  Parameters:
    `name` - the name of the configuration property
  Returns:
    the value of the configuration property. Note that in the case of on/off properties this will be returned as the string true/false
  Throws:
    `javax.xml.xquery.XQException`

### getSupportedPropertyNames

    public java.lang.String[] getSupportedPropertyNames()

  Description copied from interface: `javax.xml.xquery.XQDataSource`
  Returns an array containing the property names supported by this `XQDataSource`. Implementations that support user name and password must recognize the user name and password properties listed below.

  `user` | the user name to use for creating a connection
  `password` | the password to use for creating a connection

  Any additional properties are implementation-defined.

  Specified by:
    `getSupportedPropertyNames` in interface `javax.xml.xquery.XQDataSource`
  Returns:
    `String[]` an array of property names supported by this implementation

### setLoginTimeout

    public void setLoginTimeout(int seconds)
                         throws javax.xml.xquery.XQException

  Description copied from interface: `javax.xml.xquery.XQDataSource`
  Sets the maximum time in seconds that this datasource will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise, it specifies that there is no timeout. When a `XQDataSource` object is created, the login timeout is initially zero. It is implementation-defined whether the specified login timeout is actually used by the data source implementation. If the connection is created over an existing JDBC connection, then the login timeout value from the underlying JDBC connection may be used.

  Specified by:
    `setLoginTimeout` in interface `javax.xml.xquery.XQDataSource`
  Parameters:
    `seconds` - the datasource login time limit
  Throws:
    `javax.xml.xquery.XQException` - if a datasource access error occurs

### setLogWriter

    public void setLogWriter(java.io.PrintWriter out)
                      throws javax.xml.xquery.XQException

  Description copied from interface: `javax.xml.xquery.XQDataSource`
  Sets the log writer for this `XQDataSource` object to the given `java.io.PrintWriter` object. The log writer is a character output stream to which all logging and tracing messages for this datasource will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. When a `XQDataSource` object is created the log writer is initially `null`; in other words, the default is for logging to be disabled.

  Specified by:
    `setLogWriter` in interface `javax.xml.xquery.XQDataSource`
  Parameters:
    `out` - the new log writer; to disable logging, set to `null`
  Throws:
    `javax.xml.xquery.XQException` - if a datasource access error occurs

### setProperties

    public void setProperties(java.util.Properties props)
                       throws javax.xml.xquery.XQException

  Description copied from interface: `javax.xml.xquery.XQDataSource`
  Sets the data source properties from the specified `Properties` instance. Properties set before this call will still apply but those with the same name as any of these properties will be replaced. Properties set after this call also apply and may replace properties set during this call.

  If the implementation does not support one or more of the given property names, or if it can determine that the value given for a specific property is invalid, then an exception is thrown. If an exception is thrown, then no previous value is overwritten. is invalid, then an exception is raised.

  Specified by:
    `setProperties` in interface `javax.xml.xquery.XQDataSource`
  Parameters:
    `props` - the list of properties to set
  Throws:
    `javax.xml.xquery.XQException` - if (1) a given property is not recognized, (2) the value for a given property is determined to be invalid, or (3) the `props` parameter is `null`

### setProperty

    public void setProperty(java.lang.String name,
                            java.lang.String value)
                     throws javax.xml.xquery.XQException

  Set a configuration property. The properties that are supported, and their meanings, are the same as the properties that can be obtained using "set" methods; for example `setProperty("dtdValidation", "true")` has the same effect as `setDtdValidation("true")`.

  Further Saxon configuration properties can be set via the Saxon `Configuration` object, which can be obtained using the `getConfiguration()` method.

  Specified by:
    `setProperty` in interface `javax.xml.xquery.XQDataSource`
  Parameters:
    `name` - the name of the configuration property
    `value` - the value of the configuration property
  Throws:
    `javax.xml.xquery.XQException`

### setAllowExternalFunctions

    public void setAllowExternalFunctions(java.lang.String value)

  Say whether queries are allowed to call external functions.

  Parameters:
    `value` - set to "true" if external function calls are allowed (default) or "false" otherwise

### getAllowExternalFunctions

    public java.lang.String getAllowExternalFunctions()

  Ask whether queries are allowed to call external functions.

  Returns:
    "true" if external function calls are allowed, "false" otherwise

### setDtdValidation

    public void setDtdValidation(java.lang.String value)

  Say whether source documents are to be parsed with DTD validation enabled

  Parameters:
    `value` - "true" if DTD validation is to be enabled, otherwise "false". Default is "false".

### getDtdValidation

    public java.lang.String getDtdValidation()

  Ask whether source documents are to be parsed with DTD validation enabled

  Returns:
    "true" if DTD validation is to be enabled, otherwise "false". Default is "false".

### setExpandAttributeDefaults

    public void setExpandAttributeDefaults(java.lang.String value)

  Say whether whether fixed and default values defined in a schema or DTD will be expanded. By default, or if the value is "true" (and for conformance with the specification) validation against a DTD or schema will cause default values defined in the schema or DTD to be inserted into the document. Setting this feature to "false" suppresses this behaviour. In the case of DTD-defined defaults this only works if the XML parser reports whether each attribute was specified in the source or generated by expanding a default value. Not all XML parsers report this information.

  Parameters:
    `value` - "true" if default values are to be expanded, otherwise "false". Default is "true".

### getExpandAttributeDefaults

    public java.lang.String getExpandAttributeDefaults()

  Ask whether fixed or default values defined in a schema or DTD will be expanded

  Returns:
    "true" if such values will be expanded, otherwise "false"

### setExpandXInclude

    public void setExpandXInclude(java.lang.String value)

  Say whether XInclude processing is to be applied to source documents

  Parameters:
    `value` - "true" if XInclude directives are to expanded, otherwise "false". Default is "false".

### getExpandXInclude

    public java.lang.String getExpandXInclude()

  Ask whether XInclude processing is to be applied to source documents

  Returns:
    "true" if XInclude directives are to expanded, otherwise "false". Default is "false".

### setRetainLineNumbers

    public void setRetainLineNumbers(java.lang.String value)

  Say whether source documents should have line and column information retained. This information is available via extension functions `saxon:line-number()` and `saxon:column-number()`

  Parameters:
    `value` - "true" if line and column information is to be retained, otherwise "false". Default is "false".

### getRetainLineNumbers

    public java.lang.String getRetainLineNumbers()

  Ask whether line and column information will be retained for source documents

  Returns:
    "true" if line and column information is retained, otherwise "false"

### setSchemaValidationMode

    public void setSchemaValidationMode(java.lang.String value)

  Say whether source documents should be validated against a schema

  Parameters:
    `value` - set to "strict" if source documents are to be subjected to strict validation, "lax" if source documents are to be subjected to lax validation, "skip" if source documents are not to be subjected to schema validation

### getSchemaValidationMode

    public java.lang.String getSchemaValidationMode()

  Ask whether source documents will be validated against a schema

  Returns:
    "strict" if source documents are to be subjected to strict validation, "lax" if source documents are to be subjected to lax validation, "skip" if source documents are not to be subjected to schema validation

### setStripWhitespace

    public void setStripWhitespace(java.lang.String value)

  Say whether whitespace should be stripped when loading source documents

  Parameters:
    `value` - "all" if all whitespace text nodes are to be stripped, "ignorable" if only whitespace text nodes in elements defined in a schema or DTD as having element-only content are to be stripped, "none" if no whitespace text nodes are to be stripped

### getStripWhitespace

    public java.lang.String getStripWhitespace()

  Ask whether whitespace will be stripped when loading source documents

  Returns:
    "all" if all whitespace text nodes are to be stripped, "ignorable" if only whitespace text nodes in elements defined in a schema or DTD as having element-only content are to be stripped, "none" if no whitespace text nodes are to be stripped

### setUseXsiSchemaLocation

    public void setUseXsiSchemaLocation(java.lang.String value)

  Say whether the schema processor is to take account of xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes encountered in an instance document being validated

  Parameters:
    `value` - set to "true" if these attributes are to be recognized (default) or "false" otherwise

### getUseXsiSchemaLocation

    public java.lang.String getUseXsiSchemaLocation()

  Ask whether the schema processor is to take account of xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes encountered in an instance document being validated

  Returns:
    "true" if these attributes are to be recognized (default) or "false" otherwise

### setXmlVersion

    public void setXmlVersion(java.lang.String value)

  Say whether XML 1.0 or XML 1.1 rules for XML names are to be followed

  Parameters:
    `value` - "1.0" (default) if XML 1.0 rules are to be used, "1.1" if XML 1.1 rules apply

### getXmlVersion

    public java.lang.String getXmlVersion()

  Ask whether XML 1.0 or XML 1.1 rules for XML names are to be followed

  Returns:
    "1.0" if XML 1.0 rules are to be used, "1.1" if XML 1.1 rules apply

### setXsdVersion

    public void setXsdVersion(java.lang.String value)

  Say whether XML Schema 1.0 syntax must be used or whether XML Schema 1.1 features are allowed

  Parameters:
    `value` - "1.0" (default) if XML Schema 1.0 rules are to be followed, "1.1" if XML Schema 1.1 features may be used

### getXsdVersion

    public java.lang.String getXsdVersion()

  Ask whether XML Schema 1.0 syntax must be used or whether XML Schema 1.1 features are allowed

  Returns:
    "1.0" (default) if XML Schema 1.0 rules are to be followed, "1.1" if XML Schema 1.1 features may be used

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) Saxonica Limited. All rights reserved.