biz.c24.io.api.data
Class XPathStatement

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

public class XPathStatement
extends Object
implements Serializable

An immutable XPath statement which may or may not be namespace aware.

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

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

See Also:
Serialized Form

Constructor Summary
XPathStatement(String xpath)
          Creates a new non-namespace aware XPath statement.
XPathStatement(String xpath, boolean ignoreDocumentNode, boolean namespaceAware)
          Creates a new, possibly namespace aware, instance with the specified XPath statement.
XPathStatement(String xpath, boolean ignoreDocumentNode, NamespaceMapping[] namespaces)
          Creates a new instances with the specified XPath statement and namespaces If namespaces == null || namespaces.length == 0 then this constructor will create a non-namespace aware instance.
 
Method Summary
 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.
 String getXPath()
          Returns the XPath statement.
 boolean isIgnoreDocumentNode()
          Whether the document node will be skipped whilst traversing the descendant axis.
 boolean isNamespaceAware()
          Returns whether this statement is namespace aware.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XPathStatement

public XPathStatement(String xpath)
Creates a new non-namespace aware XPath statement.

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

Parameters:
xpath - The XPath statement - which should NOT include namespace prefixes.
Throws:
IllegalArgumentException - If no XPAth statement was specified.

XPathStatement

public XPathStatement(String xpath,
                      boolean ignoreDocumentNode,
                      boolean namespaceAware)
Creates a new, possibly namespace aware, instance with the specified XPath statement.

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

Parameters:
xpath - The XPath statement - which should NOT include namespace prefixes.
ignoreDocumentNode - Whether to skip the document node whilst traversing the descendant axis.
namespaceAware - Whether to take account of namespaces.
Throws:
IllegalArgumentException - If no XPAth statement was specified.

XPathStatement

public XPathStatement(String xpath,
                      boolean ignoreDocumentNode,
                      NamespaceMapping[] namespaces)
Creates a new instances with the specified XPath statement and namespaces

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

Parameters:
xpath - The XPath 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.
Throws:
IllegalArgumentException - If no XPAth statement was specified.
Method Detail

getXPath

public String getXPath()
Returns the XPath statement.

Returns:
The XPath.

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 XPath 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.

toString

public String toString()
Overrides:
toString in class Object


C24 Technologies © 2002-2012: All Rights Reserved.