Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.taglibs.standard.tag.common.xml
Class XPathUtil

    java.lang.Object
      org.apache.taglibs.standard.tag.common.xml.XPathUtil

    public class XPathUtil

extends Object

Support for tag handlers that evaluate XPath expressions.

Author:
  Shawn Bayern, Ramesh Mandava ( ramesh.mandava@sun.com ), Pierre Delisle ( pierre.delisle@sun.com )

Constructor Summary
`XPathUtil(PageContext pc)` Constructs a new XPathUtil object associated with the given PageContext.

Method Summary
`protected Node` | `adaptParamsForXalan(Node n, String xpath, XPathVariableResolver jxvr)` To evaluate an XPath expression using Xalan, we need to create an XPath object, which wraps an expression object and provides general services for execution of that expression.
`boolean` | `booleanValueOf(Node n, String xpathString)` Evaluate an XPath expression to a boolean value.
`static Node` | `getContext(Tag t)`
`static void` | `printDetails(Node n)`
`List` | `selectNodes(Node n, String xpathString)` Evaluate an XPath expression to a List of nodes.
`Node` | `selectSingleNode(Node n, String xpathString)` Evaluate an XPath expression to a single node.
`String` | `valueOf(Node n, String xpathString)` Evaluate an XPath expression to a String value.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XPathUtil

    public XPathUtil(PageContext pc)

  Constructs a new XPathUtil object associated with the given PageContext.

Method Detail

### valueOf

    public String valueOf(Node n,
                          String xpathString)
                   throws JspTagException

  Evaluate an XPath expression to a String value.

  Throws:
    `JspTagException`

### booleanValueOf

    public boolean booleanValueOf(Node n,
                                  String xpathString)
                           throws JspTagException

  Evaluate an XPath expression to a boolean value.

  Throws:
    `JspTagException`

### selectNodes

    public List selectNodes(Node n,
                            String xpathString)
                     throws JspTagException

  Evaluate an XPath expression to a List of nodes.

  Throws:
    `JspTagException`

### selectSingleNode

    public Node selectSingleNode(Node n,
                                 String xpathString)
                          throws JspTagException

  Evaluate an XPath expression to a single node.

  Throws:
    `JspTagException`

### adaptParamsForXalan

    protected Node adaptParamsForXalan(Node n,
                                       String xpath,
                                       XPathVariableResolver jxvr)

  To evaluate an XPath expression using Xalan, we need to create an XPath object, which wraps an expression object and provides general services for execution of that expression. An XPath object can be instantiated with the following information: - XPath expression to evaluate - SourceLocator (reports where an error occurred in the XML source or transformation instructions) - PrefixResolver (resolve prefixes to namespace URIs) - type (one of SELECT or MATCH) - ErrorListener (customized error handling) Execution of the XPath expression represented by an XPath object is done via method execute which takes the following parameters: - XPathContext The execution context - Node contextNode The node that "." expresses - PrefixResolver namespaceContext The context in which namespaces in the XPath are supposed to be expanded. Given all of this, if no context node is set for the evaluation of the XPath expression, one must be set so Xalan can successfully evaluate a JSTL XPath expression. (it will not work if the context node is given as a varialbe at the beginning of the expression)

### getContext

    public static Node getContext(Tag t)
                           throws JspTagException

  Throws:
    `JspTagException`

### printDetails

    public static void printDetails(Node n)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007 Mort Bay Consulting. All Rights Reserved.