public class SaxonXQDataSource extends java.lang.Object implements XQDataSource
Constructor and Description |
---|
SaxonXQDataSource()
Create a SaxonXQDataSource using a default configuration.
|
SaxonXQDataSource(Configuration config)
Create a Saxon XQDataSource with a specific configuration
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAllowExternalFunctions()
Ask whether queries are allowed to call external functions.
|
Configuration |
getConfiguration()
Get the Saxon Configuration in use.
|
XQConnection |
getConnection()
Attempts to create a connection to an XML datasource.
|
XQConnection |
getConnection(java.sql.Connection con)
Get a connection based on an underlying JDBC connection
|
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 |
registerExtensionFunction(ExtensionFunctionDefinition function)
Register an extension function that is to be made available within any query.
|
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
|
public SaxonXQDataSource()
public SaxonXQDataSource(Configuration config)
config
- The Saxon configuration to be usedpublic Configuration getConfiguration()
public XQConnection getConnection() throws XQException
XQDataSource
getConnection
in interface XQDataSource
XQException
- if a datasource access error occurspublic XQConnection getConnection(java.sql.Connection con) throws XQException
getConnection
in interface XQDataSource
con
- the JDBC connectionXQException
- The Saxon implementation of this method always throws
an XQException, indicating that Saxon does not support connection to a JDBC data source.public XQConnection getConnection(java.lang.String username, java.lang.String password) throws XQException
getConnection
in interface XQDataSource
username
- the user namepassword
- the passwordXQException
public int getLoginTimeout()
XQDataSource
getLoginTimeout
in interface XQDataSource
public java.io.PrintWriter getLogWriter()
XQDataSource
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.getLogWriter
in interface XQDataSource
null
if logging is disabledpublic java.lang.String getProperty(java.lang.String name) throws XQException
getProperty("dtdValidation")
returns the same result as getDtdValidation()
.
Further Saxon configuration properties are available using the URIs defined as constants in
FeatureKeys
getProperty
in interface XQDataSource
name
- the name of the configuration propertyXQException
public java.lang.String[] getSupportedPropertyNames()
XQDataSource
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 |
getSupportedPropertyNames
in interface XQDataSource
String[]
an array of property names
supported by this implementationpublic void setLoginTimeout(int seconds) throws XQException
XQDataSource
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.setLoginTimeout
in interface XQDataSource
seconds
- the datasource login time limitXQException
- if a datasource access error occurspublic void setLogWriter(java.io.PrintWriter out) throws XQException
XQDataSource
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.setLogWriter
in interface XQDataSource
out
- the new log writer; to disable logging, set to
null
XQException
- if a datasource access error occurspublic void setProperties(java.util.Properties props) throws XQException
XQDataSource
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.
setProperties
in interface XQDataSource
props
- the list of properties to setXQException
- 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
public void setProperty(java.lang.String name, java.lang.String value) throws XQException
setProperty("dtdValidation", "true")
has the same effect as
setDtdValidation("true")
.
Further Saxon configuration properties are available using the URIs defined as constants in
FeatureKeys
setProperty
in interface XQDataSource
name
- the name of the configuration propertyvalue
- the value of the configuration propertyXQException
public void setAllowExternalFunctions(java.lang.String value)
value
- set to "true" if external function calls are allowed (default) or "false" otherwisepublic java.lang.String getAllowExternalFunctions()
public void setDtdValidation(java.lang.String value)
value
- "true" if DTD validation is to be enabled, otherwise "false". Default is "false".public java.lang.String getDtdValidation()
public void setExpandAttributeDefaults(java.lang.String value)
value
- "true" if default values are to be expanded, otherwise "false". Default is "true".public java.lang.String getExpandAttributeDefaults()
public void setExpandXInclude(java.lang.String value)
value
- "true" if XInclude directives are to expanded, otherwise "false". Default is "false".public java.lang.String getExpandXInclude()
public void setRetainLineNumbers(java.lang.String value)
saxon:line-number()
and
saxon:column-number()
value
- "true" if line and column information is to be retained, otherwise "false". Default is "false".public java.lang.String getRetainLineNumbers()
public void setSchemaValidationMode(java.lang.String value)
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 validationpublic java.lang.String getSchemaValidationMode()
public void setStripWhitespace(java.lang.String value)
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 strippedpublic java.lang.String getStripWhitespace()
public void setUseXsiSchemaLocation(java.lang.String value)
value
- set to "true" if these attributes are to be recognized (default) or "false" otherwisepublic java.lang.String getUseXsiSchemaLocation()
public void setXmlVersion(java.lang.String value)
value
- "1.0" (default) if XML 1.0 rules are to be used, "1.1" if XML 1.1
rules applypublic java.lang.String getXmlVersion()
public void setXsdVersion(java.lang.String value)
value
- "1.0" (default) if XML Schema 1.0 rules are to be followed, "1.1" if XML Schema 1.1
features may be usedpublic java.lang.String getXsdVersion()
public void registerExtensionFunction(ExtensionFunctionDefinition function)
ExtensionFunctionDefinition
, using an arbitrary name and namespace.
This supplements the ability to call arbitrary Java methods using a namespace and local name
that are related to the Java class and method name.
This method is a Saxon extension to the XQJ interface
function
- the class that implements the extension function. This must be a class that extends
ExtensionFunctionCall
, and it must have a public zero-argument
constructorjava.lang.IllegalArgumentException
- if the class cannot be instantiated or does not extend
ExtensionFunctionCall
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.