biz.c24.io.api.data
Class XQueryStatement

java.lang.Object
  extended by biz.c24.io.api.data.XQueryStatement
All Implemented Interfaces:
Serializable

public class XQueryStatement
extends Object
implements Serializable

An immutable XQuery expression which may or may not be namespace aware.

This class wraps the XQuery expression and an optional set of namespace mappings that are used by it. If for example the XQuery statement read:

 //c24:party/c24:name
 
then a namespace mapping should exist for the "c24" prefix.

See Also:
Serialized Form

Constructor Summary
XQueryStatement(InputStream stream)
          Creates a new namespace aware XQuery query stream.
XQueryStatement(InputStream stream, boolean ignoreDocumentNode, boolean namespaceAware, net.sf.saxon.query.ModuleURIResolver moduleResolver)
          Creates a new, possibly namespace aware, instance with the specified XQuery query stream.
XQueryStatement(InputStream xqStream, boolean ignoreDocumentNode, NamespaceMapping[] namespaces, net.sf.saxon.query.ModuleURIResolver moduleResolver)
          Creates a new instances with the specified XQuery query stream and namespaces If namespaces == null || namespaces.length == 0 then this constructor will create a non-namespace aware instance.
XQueryStatement(String xquery)
          Creates a new namespace aware XQuery query.
XQueryStatement(String xquery, boolean ignoreDocumentNode, boolean namespaceAware, net.sf.saxon.query.ModuleURIResolver moduleResolver)
          Creates a new, possibly namespace aware, instance with the specified XQuery query.
XQueryStatement(String xquery, boolean ignoreDocumentNode, NamespaceMapping[] namespaces, net.sf.saxon.query.ModuleURIResolver moduleResolver)
          Creates a new instances with the specified XQuery query and namespaces If namespaces == null || namespaces.length == 0 then this constructor will create a non-namespace aware instance.
 
Method Summary
 net.sf.saxon.query.ModuleURIResolver getModuleResolver()
          Returns the uri resolver to resolve module imports.
 NamespaceMapping getNamespace(int index)
          Returns the namespace mapping at index.
 int getNamespaceCount()
          Returns the number of namespace mappings present.
 NamespaceMapping[] getNamespaces()
          Returns a copy of the array of namespaces held by this object.
 InputStream getXQStream()
          Returns the XQuery stream.
 String getXQuery()
          Returns the XQuery query.
 boolean isIgnoreDocumentNode()
          Whether the document node will be skipped whilst traversing the descendant axis.
 boolean isNamespaceAware()
          Returns whether this statement is namespace aware.
 void setIgnoreDocumentNode(boolean ignoreDocumentNode)
           
 void setNamespaceAware(boolean namespaceAware)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XQueryStatement

public XQueryStatement(InputStream stream)
Creates a new namespace aware XQuery query stream.

The resulting expression will skip the document node whilst traversing the descendant axis.

Parameters:
query - The XQuery expression.
Throws:
IllegalArgumentException - If no XQuery was specified.

XQueryStatement

public XQueryStatement(String xquery)
Creates a new namespace aware XQuery query.

The resulting expression will skip the document node whilst traversing the descendant axis.

Parameters:
query - The XQuery expression.
Throws:
IllegalArgumentException - If no XQuery was specified.

XQueryStatement

public XQueryStatement(InputStream stream,
                       boolean ignoreDocumentNode,
                       boolean namespaceAware,
                       net.sf.saxon.query.ModuleURIResolver moduleResolver)
Creates a new, possibly namespace aware, instance with the specified XQuery query stream.

If namespaceAware == true then since no namespace mappings are being specified the XQuery statement should only use components from the default (i.e. no prefix) namespace.

Parameters:
xquery - The XQuery statement
ignoreDocumentNode - Whether to skip the document node whilst traversing the descendant axis.
namespaceAware - Whether to take account of namespaces.
moduleResolver - to resolve imports in the query.
Throws:
IllegalArgumentException - If no XQuery stream was specified.

XQueryStatement

public XQueryStatement(String xquery,
                       boolean ignoreDocumentNode,
                       boolean namespaceAware,
                       net.sf.saxon.query.ModuleURIResolver moduleResolver)
Creates a new, possibly namespace aware, instance with the specified XQuery query.

If namespaceAware == true then since no namespace mappings are being specified the XQuery statement should only use components from the default (i.e. no prefix) namespace.

Parameters:
xquery - The XQuery statement
ignoreDocumentNode - Whether to skip the document node whilst traversing the descendant axis.
namespaceAware - Whether to take account of namespaces.
moduleResolver - to resolve imports in the query.
Throws:
IllegalArgumentException - If no XQuery expression was specified.

XQueryStatement

public XQueryStatement(InputStream xqStream,
                       boolean ignoreDocumentNode,
                       NamespaceMapping[] namespaces,
                       net.sf.saxon.query.ModuleURIResolver moduleResolver)
Creates a new instances with the specified XQuery query stream and namespaces

If namespaces == null || namespaces.length == 0 then this constructor will create a non-namespace aware instance.

Parameters:
xquery - The XQuery stream - which can include namespace prefixes.
ignoreDocumentNode - Whether to skip the document node whilst traversing the descendant axis.
namespaces - An optional array of namespace mappings used by the XQuery expression.
moduleResolver - to resolve imports in the query.
Throws:
IllegalArgumentException - If no XQuery statement was specified.

XQueryStatement

public XQueryStatement(String xquery,
                       boolean ignoreDocumentNode,
                       NamespaceMapping[] namespaces,
                       net.sf.saxon.query.ModuleURIResolver moduleResolver)
Creates a new instances with the specified XQuery query and namespaces

If namespaces == null || namespaces.length == 0 then this constructor will create a non-namespace aware instance.

Parameters:
xpath - The XQuery statement - which can include namespace prefixes.
ignoreDocumentNode - Whether to skip the document node whilst traversing the descendant axis.
namespaces - An optional array of namespace mappings used by the XPath statement.
moduleResolver - to resolve imports in the query.
Throws:
IllegalArgumentException - If no XQuery statement was specified.
Method Detail

setIgnoreDocumentNode

public void setIgnoreDocumentNode(boolean ignoreDocumentNode)

setNamespaceAware

public void setNamespaceAware(boolean namespaceAware)

getXQStream

public InputStream getXQStream()
Returns the XQuery stream.

Returns:
The XQuery stream.

getXQuery

public String getXQuery()
Returns the XQuery query.

Returns:
The XQuery query.

isIgnoreDocumentNode

public boolean isIgnoreDocumentNode()
Whether the document node will be skipped whilst traversing the descendant axis.

If this property is set to true then the XQuery statement should attempt to descend directly from below the document node and therefore NOT include it's name. This is often required since the name of the document node (i.e. the root defining element declaration) is not fixed at the point at which the rule is defined on the type.

Returns:
Whether to skip the document node.

isNamespaceAware

public boolean isNamespaceAware()
Returns whether this statement is namespace aware.

Returns:
Whether this is a namespace aware statement.

getNamespaces

public NamespaceMapping[] getNamespaces()
Returns a copy of the array of namespaces held by this object.

Returns:
The namespaces.

getNamespaceCount

public int getNamespaceCount()
Returns the number of namespace mappings present.

Returns:
The number of namespace mappings.

getNamespace

public NamespaceMapping getNamespace(int index)
Returns the namespace mapping at index.

Parameters:
index - The index of the namespace mapping to return
Returns:
The namespace mapping.

getModuleResolver

public net.sf.saxon.query.ModuleURIResolver getModuleResolver()
Returns the uri resolver to resolve module imports.

Returns:
The module resolver for imports.

toString

public String toString()
Overrides:
toString in class Object


C24 Technologies © 2002-2012: All Rights Reserved.