com.virtualweaver.xotics.datamodel
Interface XoRequestToolkit


public interface XoRequestToolkit

A toolkit class for XPath request processing. It is accessible to XPath functions to help performing operation.

Version:
4.1

Method Summary
 XdpSequence computeSteps(XdpNode ctxNode, XdpAnt[] ant)
          Computes a step with an ANT (Axis-Node-Test) filter and the context node, and returns a new sequence containing the resulting nodes.
 XdpSequence computeSteps(XdpSequence inSeq, XdpAnt[] ant)
          Computes a step with an ANT (Axis-Node-Test) filter and an input sequence, and returns a new sequence containing the resulting nodes.
 XdpSequence createContextSequence(XoNode node)
          Creates a new XPAth sequence filled with context node param.
 java.util.TreeSet createOrderedSequence()
          Utility to create an ordered tree set, with some optimizations done on it.
 XdpSequence createRootSequence()
          Creates a new sequence with root node as only item.
 XdpSequence createSequence()
          Creates a new empty sequence.
 XdpSequence except(XdpSequence[] seq)
          Computes XPath except operation of all XPath sequences given in array param seq (seq[0] except seq[1] except seq{2] ...), and returns result in seq[0].
 XdpNode getNodeById(java.lang.String id)
          Returns the XdpNode node wrapper associated to id param.
 XsdString getStringValue(XdpNode node)
          Converts node param in a string, according to XPath 2 conversion rules.
 XsdDataType getTypedValue(XdpNode node)
          Gives XS datatype corresponding to the node param.
 XdpSequence intersect(XdpSequence[] seq)
          Computes intersection of all XPath sequences given in array param seq (seq[0] | seq[1] | seq{2] ...), and returns result in seq[0].
 XdpSequence union(XdpSequence[] seq)
          Computes union of all XPath sequences given in array param seq (seq[0] & seq[1] & seq{2] ...), and returns result in seq[0].
 

Method Detail

createRootSequence

public XdpSequence createRootSequence()
Creates a new sequence with root node as only item. Use this method rather than instanciating a new XdpSequence.

Returns:
an XPath sequence containing document root node, i.e the XoDMInstance object.

createSequence

public XdpSequence createSequence()
Creates a new empty sequence. Use this method rather than instanciating a new XdpSequence, as some optimizations are done here.

Returns:
an empty XPath sequence.

createContextSequence

public XdpSequence createContextSequence(XoNode node)
Creates a new XPAth sequence filled with context node param.

Parameters:
node - the context node to put in sequence.
Returns:
the new sequence.

createOrderedSequence

public java.util.TreeSet createOrderedSequence()
Utility to create an ordered tree set, with some optimizations done on it.

Returns:
a new TreeSet

computeSteps

public XdpSequence computeSteps(XdpNode ctxNode,
                                XdpAnt[] ant)
                         throws XoException
Computes a step with an ANT (Axis-Node-Test) filter and the context node, and returns a new sequence containing the resulting nodes. Used for example in a predicate evaluation

Parameters:
ctxNode - XPAth context node
ant - the AxisNodeTest of the step
Returns:
a new sequence containing result
Throws:
XoException - if some error occurs during processing

computeSteps

public XdpSequence computeSteps(XdpSequence inSeq,
                                XdpAnt[] ant)
                         throws XoException
Computes a step with an ANT (Axis-Node-Test) filter and an input sequence, and returns a new sequence containing the resulting nodes. Typically used in a classical step evaluation

Parameters:
inSeq - input XPAth sequence
ant - Axis-Node-Test
Returns:
resulting XPath sequence
Throws:
XoException - if some error occurs during evaluation

getTypedValue

public XsdDataType getTypedValue(XdpNode node)
Gives XS datatype corresponding to the node param.

Parameters:
node - the node whose XS datatype is wanted
Returns:
in all cases an XsdDataType object

getStringValue

public XsdString getStringValue(XdpNode node)
Converts node param in a string, according to XPath 2 conversion rules.

Parameters:
node - the node to convert as string
Returns:
a string equivalent (from XPath point of vue) to node

union

public XdpSequence union(XdpSequence[] seq)
                  throws XoException
Computes union of all XPath sequences given in array param seq (seq[0] & seq[1] & seq{2] ...), and returns result in seq[0].

Parameters:
seq - an array of XPAth sequences to union
Returns:
the first array item (seq[0]) as result of union
Throws:
XoException - if some error occurred during processing

intersect

public XdpSequence intersect(XdpSequence[] seq)
                      throws XoException
Computes intersection of all XPath sequences given in array param seq (seq[0] | seq[1] | seq{2] ...), and returns result in seq[0].

Parameters:
seq - an array of XPAth sequences to intersect
Returns:
the first array item (seq[0]) as result of intersection
Throws:
XoException - if some error occurred during processing

except

public XdpSequence except(XdpSequence[] seq)
                   throws XoException
Computes XPath except operation of all XPath sequences given in array param seq (seq[0] except seq[1] except seq{2] ...), and returns result in seq[0].

Parameters:
seq - an array of XPAth sequences to process
Returns:
the first array item (seq[0]) as result of except operation
Throws:
XoException - if some error occurred during processing

getNodeById

public XdpNode getNodeById(java.lang.String id)
Returns the XdpNode node wrapper associated to id param.

Parameters:
id - ID value of wanted node
Returns:
the node embedded in XdpNode wrapper, or null if not found.