org.apache.excalibur.xml.xpath
Class Saxon8ProcessorImpl
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.excalibur.xml.xpath.AbstractProcessorImpl
org.apache.excalibur.xml.xpath.Saxon8ProcessorImpl
- All Implemented Interfaces:
- org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.thread.ThreadSafe, PrefixResolver, XPathProcessor
public class Saxon8ProcessorImpl
- extends AbstractProcessorImpl
- implements org.apache.avalon.framework.thread.ThreadSafe
This class defines the implementation of the XPathProcessor
component. This implementation depends on Saxon 8.X XSLT processor.
This implementation was tested with Saxon 8.7 release.
To configure it, add the following lines in the
cocoon.xconf file:
<xslt-processor class="org.apache.cocoon.components.xpath.Saxon7ProcessorImpl">
</xslt-processor>
|
Field Summary |
private static javax.xml.transform.TransformerFactory |
factory
|
|
Method Summary |
private net.sf.saxon.om.SequenceIterator |
evaluate(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
|
boolean |
evaluateAsBoolean(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
Evaluate XPath expression within a context. |
java.lang.Number |
evaluateAsNumber(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
Evaluate XPath expression within a context. |
java.lang.String |
evaluateAsString(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
Evaluate XPath expression within a context. |
private net.sf.saxon.om.Item |
evaluateSingle(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
|
org.w3c.dom.NodeList |
selectNodeList(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
Use an XPath string to select a nodelist. |
org.w3c.dom.Node |
selectSingleNode(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
Use an XPath string to select a single node. |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
factory
private static final javax.xml.transform.TransformerFactory factory
Saxon8ProcessorImpl
public Saxon8ProcessorImpl()
evaluateAsBoolean
public boolean evaluateAsBoolean(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
- Evaluate XPath expression within a context.
- Specified by:
evaluateAsBoolean in interface XPathProcessor- Specified by:
evaluateAsBoolean in class AbstractProcessorImpl
- Parameters:
contextNode - The context node.str - A valid XPath string.resolver - a PrefixResolver, used for resolving namespace prefixes
- Returns:
- expression result as boolean.
evaluateAsNumber
public java.lang.Number evaluateAsNumber(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
- Evaluate XPath expression within a context.
- Specified by:
evaluateAsNumber in interface XPathProcessor- Specified by:
evaluateAsNumber in class AbstractProcessorImpl
- Parameters:
contextNode - The context node.str - A valid XPath string.resolver - a PrefixResolver, used for resolving namespace prefixes
- Returns:
- expression result as number.
evaluateAsString
public java.lang.String evaluateAsString(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
- Evaluate XPath expression within a context.
- Specified by:
evaluateAsString in interface XPathProcessor- Specified by:
evaluateAsString in class AbstractProcessorImpl
- Parameters:
contextNode - The context node.str - A valid XPath string.resolver - a PrefixResolver, used for resolving namespace prefixes
- Returns:
- expression result as string.
selectSingleNode
public org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
- Description copied from class:
AbstractProcessorImpl
- Use an XPath string to select a single node.
- Specified by:
selectSingleNode in interface XPathProcessor- Specified by:
selectSingleNode in class AbstractProcessorImpl
- Parameters:
contextNode - The node to start searching from.str - A valid XPath string.resolver - a PrefixResolver, used for resolving namespace prefixes
- Returns:
- The first node found that matches the XPath, or null.
selectNodeList
public org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
- Description copied from class:
AbstractProcessorImpl
- Use an XPath string to select a nodelist.
- Specified by:
selectNodeList in interface XPathProcessor- Specified by:
selectNodeList in class AbstractProcessorImpl
- Parameters:
contextNode - The node to start searching from.str - A valid XPath string.resolver - a PrefixResolver, used for resolving namespace prefixes
- Returns:
- A List, should never be null.
evaluateSingle
private net.sf.saxon.om.Item evaluateSingle(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)
evaluate
private net.sf.saxon.om.SequenceIterator evaluate(org.w3c.dom.Node contextNode,
java.lang.String str,
PrefixResolver resolver)