JavaServer Pages(TM) Standard Tag Library 1.2 API 1.0.3.Final

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

java.lang.Object
  extended by 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 ( [email protected] ), Pierre Delisle ( [email protected] )

Constructor Summary
XPathUtil(javax.servlet.jsp.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(javax.servlet.jsp.tagext.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(javax.servlet.jsp.PageContext pc)
Constructs a new XPathUtil object associated with the given PageContext.

Method Detail

valueOf

public String valueOf(Node n,
                      String xpathString)
               throws javax.servlet.jsp.JspTagException
Evaluate an XPath expression to a String value.

Throws:
javax.servlet.jsp.JspTagException

booleanValueOf

public boolean booleanValueOf(Node n,
                              String xpathString)
                       throws javax.servlet.jsp.JspTagException
Evaluate an XPath expression to a boolean value.

Throws:
javax.servlet.jsp.JspTagException

selectNodes

public List selectNodes(Node n,
                        String xpathString)
                 throws javax.servlet.jsp.JspTagException
Evaluate an XPath expression to a List of nodes.

Throws:
javax.servlet.jsp.JspTagException

selectSingleNode

public Node selectSingleNode(Node n,
                             String xpathString)
                      throws javax.servlet.jsp.JspTagException
Evaluate an XPath expression to a single node.

Throws:
javax.servlet.jsp.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(javax.servlet.jsp.tagext.Tag t)
                       throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

printDetails

public static void printDetails(Node n)

JavaServer Pages(TM) Standard Tag Library 1.2 API 1.0.3.Final

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.