biz.c24.io.api.data.jaxen
Class JaxenXPath

java.lang.Object
  extended by biz.c24.io.api.data.jaxen.JaxenXPath
All Implemented Interfaces:
IOXPath, Serializable, org.jaxen.XPath

Deprecated. Due to deficiencies in Jaxen (see biz.c24.io.api.data.jaxen for more information) this class has been deprecated. See biz.c24.io.api.data.saxon for more information on the preferred approach.

public class JaxenXPath
extends Object
implements IOXPath

Concrete implementation of IOXPath interface using Jaxen.

See Also:
biz.c24.io.api.data.jaxen, Jaxen for information on using Jaxen over C24 Integration Objects objects directly., Serialized Form

Constructor Summary
JaxenXPath(String expression)
          Deprecated.  
JaxenXPath(XPathStatement statement)
          Deprecated.  
 
Method Summary
 void addNamespace(String prefix, String uri)
          Deprecated. Add a namespace prefix-to-URI mapping for this XPath expression.
 boolean booleanValueOf(Object node)
          Deprecated. Retrieve a boolean-value interpretation of this XPath expression when evaluated against a given context.
protected  org.jaxen.FunctionContext createFunctionContext()
          Deprecated. Create a default FunctionContext.
protected  org.jaxen.NamespaceContext createNamespaceContext()
          Deprecated. Create a default NamespaceContext.
protected  org.jaxen.VariableContext createVariableContext()
          Deprecated. Create a default VariableContext.
 String debug()
          Deprecated. Returns the string version of this xpath.
 Object evaluate(Object node)
          Deprecated. Evaluate this XPath against a given context.
 boolean getBoolean(ComplexDataObject o)
          Deprecated. Returns a boolean representation of the node specified by this object's XPath expression.
protected  org.jaxen.Context getContext(Object node)
          Deprecated. Create a Context wrapper for the provided implementation-specific object.
protected  org.jaxen.ContextSupport getContextSupport()
          Deprecated. Retrieve the ContextSupport aggregation of NamespaceContext, FunctionContext, VariableContext, and Navigator.
 org.jaxen.FunctionContext getFunctionContext()
          Deprecated. Retrieve the FunctionContext used by this XPath expression.
 List getList(ComplexDataObject o)
          Deprecated. Returns a List representation of the node specified by this object's XPath expression.
 org.jaxen.NamespaceContext getNamespaceContext()
          Deprecated. Retrieve the NamespaceContext used by this XPath expression.
 org.jaxen.Navigator getNavigator()
          Deprecated. Retrieve the XML object-model-specific Navigator for us in evaluating this XPath expression.
 Number getNumber(ComplexDataObject o)
          Deprecated. Returns a Number representation of the node specified by this object's XPath expression.
 Object getObject(ComplexDataObject o)
          Deprecated. Returns an Object representation of the node specified by this object's XPath expression.
 org.jaxen.expr.Expr getRootExpr()
          Deprecated. Retrieve the root expression of the internal compiled form of this XPath expression.
 String getString(ComplexDataObject o)
          Deprecated. Returns a String representation of the node specified by this object's XPath expression.
 org.jaxen.VariableContext getVariableContext()
          Deprecated. Retrieve the VariableContext used by this XPath expression.
 Number numberValueOf(Object node)
          Deprecated. Retrieve a number-value interpretation of this XPath expression when evaluated against a given context.
 List selectNodes(Object node)
          Deprecated. Select all nodes that are selectable by this XPath expression.
protected  List selectNodesForContext(org.jaxen.Context context)
          Deprecated. Select all nodes that are selectable by this XPath expression on the given Context object.
 Object selectSingleNode(Object node)
          Deprecated. Select only the first node that is selectable by this XPath expression.
protected  Object selectSingleNodeForContext(org.jaxen.Context context)
          Deprecated. Select only the first node that is selectable by this XPath expression.
 void setFunctionContext(org.jaxen.FunctionContext functionContext)
          Deprecated. Set a FunctionContext for use with this XPath expression.
 void setNamespaceContext(org.jaxen.NamespaceContext namespaceContext)
          Deprecated. Set a NamespaceContext for use with this XPath expression.
 void setVariableContext(org.jaxen.VariableContext variableContext)
          Deprecated. Set a VariableContext for use with this XPath expression.
 String stringValueOf(Object node)
          Deprecated.  
 String toString()
          Deprecated. Return the normalized string of this XPath expression.
 String valueOf(Object node)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JaxenXPath

public JaxenXPath(String expression)
           throws org.jaxen.JaxenException
Deprecated. 

Creates a new instance with the specified xpath expression.

Parameters:
expression - The xpath expression.
Throws:
org.jaxen.JaxenException - If the xpath expression is invalid.

JaxenXPath

public JaxenXPath(XPathStatement statement)
           throws org.jaxen.JaxenException
Deprecated. 

Creates a new instance with the specified xpath statement.

Since Jaxen is not namespace aware, any namespaces specified in the XPath statement are ignored. This constructor is provided for compapability reasons with other IOXPath implementations.

Parameters:
statement - The xpath statement.
Throws:
org.jaxen.JaxenException
Method Detail

getObject

public Object getObject(ComplexDataObject o)
                 throws IOXPathException
Deprecated. 
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
Deprecated. 
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
Deprecated. 
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
Deprecated. 
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
Deprecated. 
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.

evaluate

public Object evaluate(Object node)
                throws org.jaxen.JaxenException
Deprecated. 
Evaluate this XPath against a given context.

The context of evaluation my be a document, an element, or a set of elements.

If the expression evaluates to a single primitive (String, Number or Boolean) type, it is returned directly. Otherwise, the returned value is a List (a node-set, in the terms of the specification) of values.

When using this method, one must be careful to test the class of the returned objects, and of each of the composite members if a List is returned. If the returned members are XML entities, they will be the actual Document, Element or Attribute objects as defined by the concrete XML object-model implementation, directly from the context document. This does not return copies of anything, but merely returns references to entities within the source document.

Specified by:
evaluate in interface org.jaxen.XPath
Parameters:
node - The node, nodeset or Context object for evaluation. This value can be null.
Returns:
The result of evaluating the XPath expression against the supplied context.
Throws:
org.jaxen.JaxenException

selectNodes

public List selectNodes(Object node)
                 throws org.jaxen.JaxenException
Deprecated. 
Select all nodes that are selectable by this XPath expression. If multiple nodes match, multiple nodes will be returned.

NOTE: In most cases, nodes will be returned in document-order, as defined by the XML Canonicalization specification. The exception occurs when using XPath expressions involving the union operator (denoted with the pipe '|' character).

Specified by:
selectNodes in interface org.jaxen.XPath
Parameters:
node - The node, nodeset or Context object for evaluation. This value can be null.
Returns:
The node-set of all items selected by this XPath expression.
Throws:
org.jaxen.JaxenException
See Also:
selectSingleNode(java.lang.Object)

selectSingleNode

public Object selectSingleNode(Object node)
                        throws org.jaxen.JaxenException
Deprecated. 
Select only the first node that is selectable by this XPath expression. If multiple nodes match, only one node will be returned. NOTE: In most cases, the selected node will be the first selectable node in document-order, as defined by the XML Canonicalization specification. The exception occurs when using XPath expressions involving the union operator (denoted with the pipe '|' character).

Specified by:
selectSingleNode in interface org.jaxen.XPath
Parameters:
node - The node, nodeset or Context object for evaluation. This value can be null.
Returns:
The node-set of all items selected by this XPath expression.
Throws:
org.jaxen.JaxenException
See Also:
selectNodes(java.lang.Object)

valueOf

public String valueOf(Object node)
               throws org.jaxen.JaxenException
Deprecated. 

Specified by:
valueOf in interface org.jaxen.XPath
Throws:
org.jaxen.JaxenException

stringValueOf

public String stringValueOf(Object node)
                     throws org.jaxen.JaxenException
Deprecated. 
Specified by:
stringValueOf in interface org.jaxen.XPath
Throws:
org.jaxen.JaxenException

booleanValueOf

public boolean booleanValueOf(Object node)
                       throws org.jaxen.JaxenException
Deprecated. 
Retrieve a boolean-value interpretation of this XPath expression when evaluated against a given context.

The boolean-value of the expression is determined per the boolean(..) core function as defined in the XPath specification. This means that an expression that selects zero nodes will return false, while an expression that selects one-or-more nodes will return true.

Specified by:
booleanValueOf in interface org.jaxen.XPath
Parameters:
node - The node, nodeset or Context object for evaluation. This value can be null.
Returns:
The boolean-value interpretation of this expression.
Throws:
org.jaxen.JaxenException

numberValueOf

public Number numberValueOf(Object node)
                     throws org.jaxen.JaxenException
Deprecated. 
Retrieve a number-value interpretation of this XPath expression when evaluated against a given context.

The number-value of the expression is determined per the number(..) core function as defined in the XPath specification. This means that if this expression selects multiple nodes, the number-value of the first node is returned.

Specified by:
numberValueOf in interface org.jaxen.XPath
Parameters:
node - The node, nodeset or Context object for evaluation. This value can be null.
Returns:
The number-value interpretation of this expression.
Throws:
org.jaxen.JaxenException

addNamespace

public void addNamespace(String prefix,
                         String uri)
                  throws org.jaxen.JaxenException
Deprecated. 
Add a namespace prefix-to-URI mapping for this XPath expression.

Namespace prefix-to-URI mappings in an XPath are independant of those used within any document. Only the mapping explicitly added to this XPath will be available for resolving the XPath expression.

This is a convenience method for adding mappings to the default NamespaceContext in place for this XPath. If you have installed a specific custom NamespaceContext, then this method will throw a JaxenException.

Specified by:
addNamespace in interface org.jaxen.XPath
Parameters:
prefix - The namespace prefix.
uri - The namespace URI.
Throws:
org.jaxen.JaxenException - If a NamespaceContext used by this XPath has been explicitly installed.

setNamespaceContext

public void setNamespaceContext(org.jaxen.NamespaceContext namespaceContext)
Deprecated. 
Set a NamespaceContext for use with this XPath expression.

A NamespaceContext is responsible for translating namespace prefixes within the expression into namespace URIs.

Specified by:
setNamespaceContext in interface org.jaxen.XPath
Parameters:
namespaceContext - The NamespaceContext to install for this expression.
See Also:
NamespaceContext, NamespaceContext.translateNamespacePrefixToUri(java.lang.String)

setFunctionContext

public void setFunctionContext(org.jaxen.FunctionContext functionContext)
Deprecated. 
Set a FunctionContext for use with this XPath expression.

A FunctionContext is responsible for resolving all function calls used within the expression.

Specified by:
setFunctionContext in interface org.jaxen.XPath
Parameters:
functionContext - The FunctionContext to install for this expression.
See Also:
FunctionContext, FunctionContext.getFunction(java.lang.String, java.lang.String, java.lang.String)

setVariableContext

public void setVariableContext(org.jaxen.VariableContext variableContext)
Deprecated. 
Set a VariableContext for use with this XPath expression.

A VariableContext is responsible for resolving all variables referenced within the expression.

Specified by:
setVariableContext in interface org.jaxen.XPath
Parameters:
variableContext - The VariableContext to install for this expression.
See Also:
VariableContext, VariableContext.getVariableValue(java.lang.String, java.lang.String, java.lang.String)

getNamespaceContext

public org.jaxen.NamespaceContext getNamespaceContext()
Deprecated. 
Retrieve the NamespaceContext used by this XPath expression.

A FunctionContext is responsible for resolving all function calls used within the expression.

If this XPath expression has not previously had a NamespaceContext installed, a new default NamespaceContext will be created, installed and returned.

Specified by:
getNamespaceContext in interface org.jaxen.XPath
Returns:
The NamespaceContext used by this expression.
See Also:
NamespaceContext

getFunctionContext

public org.jaxen.FunctionContext getFunctionContext()
Deprecated. 
Retrieve the FunctionContext used by this XPath expression.

A FunctionContext is responsible for resolving all function calls used within the expression.

If this XPath expression has not previously had a FunctionContext installed, a new default FunctionContext will be created, installed and returned.

Specified by:
getFunctionContext in interface org.jaxen.XPath
Returns:
The FunctionContext used by this expression.
See Also:
FunctionContext

getVariableContext

public org.jaxen.VariableContext getVariableContext()
Deprecated. 
Retrieve the VariableContext used by this XPath expression.

A VariableContext is responsible for resolving all variables referenced within the expression.

If this XPath expression has not previously had a VariableContext installed, a new default VariableContext will be created, installed and returned.

Specified by:
getVariableContext in interface org.jaxen.XPath
Returns:
The VariableContext used by this expression.
See Also:
VariableContext

getRootExpr

public org.jaxen.expr.Expr getRootExpr()
Deprecated. 
Retrieve the root expression of the internal compiled form of this XPath expression.

Internally, Jaxen maintains a form of Abstract Syntax Tree (AST) to represent the structure of the XPath expression. This is normally not required during normal consumer-grade usage of Jaxen. This method is provided for hard-core users who wish to manipulate or inspect a tree-based version of the expression.

Returns:
The root of the AST of this expression.

toString

public String toString()
Deprecated. 
Return the normalized string of this XPath expression.

During parsing, the XPath expression is normalized, removing abbreviations and other convenience notation. This method returns the fully normalized representation of the original expression.

Overrides:
toString in class Object
Returns:
The normalized XPath expression string.

debug

public String debug()
Deprecated. 
Returns the string version of this xpath.

Returns:
The normalized XPath expression string.
See Also:
toString()

getContext

protected org.jaxen.Context getContext(Object node)
Deprecated. 
Create a Context wrapper for the provided implementation-specific object.

Parameters:
node - The implementation-specific object to be used as the context.
Returns:
A Context wrapper around the object.

getContextSupport

protected org.jaxen.ContextSupport getContextSupport()
Deprecated. 
Retrieve the ContextSupport aggregation of NamespaceContext, FunctionContext, VariableContext, and Navigator.

Returns:
Aggregate ContextSupport for this XPath expression.

getNavigator

public org.jaxen.Navigator getNavigator()
Deprecated. 
Retrieve the XML object-model-specific Navigator for us in evaluating this XPath expression.

Specified by:
getNavigator in interface org.jaxen.XPath
Returns:
The implementation-specific Navigator.

createFunctionContext

protected org.jaxen.FunctionContext createFunctionContext()
Deprecated. 
Create a default FunctionContext.

Returns:
The default FunctionContext.

createNamespaceContext

protected org.jaxen.NamespaceContext createNamespaceContext()
Deprecated. 
Create a default NamespaceContext.

Returns:
A default NamespaceContext instance.

createVariableContext

protected org.jaxen.VariableContext createVariableContext()
Deprecated. 
Create a default VariableContext.

Returns:
A default VariableContext instance.

selectNodesForContext

protected List selectNodesForContext(org.jaxen.Context context)
                              throws org.jaxen.JaxenException
Deprecated. 
Select all nodes that are selectable by this XPath expression on the given Context object. If multiple nodes match, multiple nodes will be returned.

NOTE: In most cases, nodes will be returned in document-order, as defined by the XML Canonicalization specification. The exception occurs when using XPath expressions involving the union operator (denoted with the pipe '|' character).

Parameters:
context - is the Context which gets evaluated.
Returns:
The node-set of all items selected by this XPath expression.
Throws:
org.jaxen.JaxenException

selectSingleNodeForContext

protected Object selectSingleNodeForContext(org.jaxen.Context context)
                                     throws org.jaxen.JaxenException
Deprecated. 
Select only the first node that is selectable by this XPath expression. If multiple nodes match, only one node will be returned. NOTE: In most cases, the selected node will be the first selectable node in document-order, as defined by the XML Canonicalization specification. The exception occurs when using XPath expressions involving the union operator (denoted with the pipe '|' character).

Parameters:
context - is the Context which gets evaluated.
Returns:
The node-set of all items selected by this XPath expression.
Throws:
org.jaxen.JaxenException
See Also:
selectNodesForContext(org.jaxen.Context)


C24 Technologies © 2002-2012: All Rights Reserved.