biz.c24.io.api.data.saxon
Class SaxonXPath

java.lang.Object
  extended by biz.c24.io.api.data.saxon.SaxonXPath
All Implemented Interfaces:
IOXPath

public class SaxonXPath
extends Object
implements IOXPath

Concrete implementation of IOXPath interface using Saxon.

See Also:
biz.c24.io.api.data.saxon, Saxon for information on using Saxon over C24 Integration Objects objects directly.

Constructor Summary
SaxonXPath(String expression)
          Creates a new instance with the specified xpath expression.
SaxonXPath(XPathStatement statement)
          Creates a new instance with the specified xpath statement.
 
Method Summary
static net.sf.saxon.sxpath.XPathExpression createExpression(XPathStatement statement, net.sf.saxon.Configuration config)
          Helper method to create an XPath expression with all relevant namespaces initialized.
static int fixXpath(String expression)
           
 boolean getBoolean(ComplexDataObject o)
          Returns a boolean representation of the node specified by this object's XPath expression.
 List getList(ComplexDataObject o)
          Returns a List representation of the node specified by this object's XPath expression.
 Number getNumber(ComplexDataObject o)
          Returns a Number representation of the node specified by this object's XPath expression.
 Object getObject(ComplexDataObject o)
          Returns an Object representation of the node specified by this object's XPath expression.
 String getString(ComplexDataObject o)
          Returns a String representation of the node specified by this object's XPath expression.
 void setConfiguration(net.sf.saxon.Configuration config)
          Sets the configuration to be used by Saxon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaxonXPath

public SaxonXPath(String expression)
Creates a new instance with the specified xpath expression.

Parameters:
expression - The xpath expression.

SaxonXPath

public SaxonXPath(XPathStatement statement)
Creates a new instance with the specified xpath statement.

Parameters:
statement - The xpath statement.
Method Detail

setConfiguration

public void setConfiguration(net.sf.saxon.Configuration config)
Sets the configuration to be used by Saxon.

This allows multiple instances to share a configuration managed externally and reuse it's name pool.

Parameters:
config -

createExpression

public static net.sf.saxon.sxpath.XPathExpression createExpression(XPathStatement statement,
                                                                   net.sf.saxon.Configuration config)
                                                            throws IOXPathException
Helper method to create an XPath expression with all relevant namespaces initialized.

Parameters:
statement - The XPath statement to create the expression from.
config - The configuration.
Returns:
The expression.
Throws:
IOXPathException - If there is an error generating the XPath expression.

getObject

public Object getObject(ComplexDataObject o)
                 throws IOXPathException
Description copied from interface: IOXPath
Returns an Object representation of the node specified by this object's XPath expression.

Specified by:
getObject in interface IOXPath
Parameters:
o - The ComplexDataObject on which the expression will be evaluated.
Returns:
The referenced node as an Object.
Throws:
IOXPathException - If the underlying xpath implementation rejects the xpath expression.

getList

public List getList(ComplexDataObject o)
             throws IOXPathException
Description copied from interface: IOXPath
Returns a List representation of the node specified by this object's XPath expression.

Specified by:
getList in interface IOXPath
Parameters:
o - The ComplexDataObject on which the expression will be evaluated.
Returns:
The referenced node as a List.
Throws:
IOXPathException - If the underlying xpath implementation rejects the xpath expression.

getBoolean

public boolean getBoolean(ComplexDataObject o)
                   throws IOXPathException
Description copied from interface: IOXPath
Returns a boolean representation of the node specified by this object's XPath expression.

Specified by:
getBoolean in interface IOXPath
Parameters:
o - The ComplexDataObject on which the expression will be evaluated.
Returns:
true if the underlying implementation evaluates the XPath expression to true.
Throws:
IOXPathException - If the underlying xpath implementation rejects the xpath expression.

getNumber

public Number getNumber(ComplexDataObject o)
                 throws IOXPathException
Description copied from interface: IOXPath
Returns a Number representation of the node specified by this object's XPath expression.

Specified by:
getNumber in interface IOXPath
Parameters:
o - The ComplexDataObject on which the expression will be evaluated.
Returns:
The referenced node as a Number.
Throws:
IOXPathException - If the underlying xpath implementation rejects the xpath expression.

getString

public String getString(ComplexDataObject o)
                 throws IOXPathException
Description copied from interface: IOXPath
Returns a String representation of the node specified by this object's XPath expression.

Specified by:
getString in interface IOXPath
Parameters:
o - The ComplexDataObject on which the expression will be evaluated.
Returns:
The referenced node as a String.
Throws:
IOXPathException - If the underlying xpath implementation rejects the xpath expression.

fixXpath

public static int fixXpath(String expression)


C24 Technologies © 2002-2012: All Rights Reserved.