Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.taglibs.standard.tag.common.xml
Class XPathUtil  view XPathUtil download XPathUtil.java

java.lang.Object
  extended byorg.apache.taglibs.standard.tag.common.xml.XPathUtil

public class XPathUtil
extends java.lang.Object

Support for tag handlers that evaluate XPath expressions.


Nested Class Summary
protected  class XPathUtil.JstlVariableContext
          org.apache.xpath.VariableStack defines a class to keep track of a stack for template arguments and variables.
 
Field Summary
private static java.lang.String APP_NS_URL
           
private static java.lang.String APP_P
           
private static java.lang.String COOKIE_NS_URL
           
private static java.lang.String COOKIE_P
           
(package private) static org.w3c.dom.Document d
           
(package private) static javax.xml.parsers.DocumentBuilder db
           
(package private) static javax.xml.parsers.DocumentBuilderFactory dbf
           
private static java.util.HashMap exprCache
           
(package private)  int globalVarSize
           
private static java.lang.String HEADER_NS_URL
           
private static java.lang.String HEADER_P
           
private static java.lang.String INITPARAM_NS_URL
           
private static java.lang.String INITPARAM_P
           
private static JSTLPrefixResolver jstlPrefixResolver
           
(package private)  java.lang.String modifiedXPath
           
private static java.lang.String PAGE_NS_URL
           
private static java.lang.String PAGE_P
           
private  javax.servlet.jsp.PageContext pageContext
           
private static java.lang.String PARAM_NS_URL
           
private static java.lang.String PARAM_P
           
private static java.lang.String REQUEST_NS_URL
           
private static java.lang.String REQUEST_P
           
private static java.lang.String SESSION_NS_URL
           
private static java.lang.String SESSION_P
           
 
Constructor Summary
XPathUtil(javax.servlet.jsp.PageContext pc)
          Constructs a new XPathUtil object associated with the given PageContext.
 
Method Summary
protected  org.w3c.dom.Node adaptParamsForXalan(XPathUtil.JstlVariableContext jvc, org.w3c.dom.Node n, java.lang.String xpath)
          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(org.w3c.dom.Node n, java.lang.String xpath)
          Evaluate an XPath expression to a boolean value.
private  java.util.Vector fillVarStack(XPathUtil.JstlVariableContext vs, org.apache.xpath.XPathContext xpathSupport)
           
static org.w3c.dom.Node getContext(javax.servlet.jsp.tagext.Tag t)
           
private static org.w3c.dom.Document getDocumentForNode(org.w3c.dom.Node node)
           
(package private) static org.w3c.dom.Document getDummyDocument()
           
(package private) static org.w3c.dom.Document getDummyDocumentWithoutRoot()
           
private  org.apache.xpath.VariableStack getLocalContext()
          Returns a locally appropriate context given a node.
 java.util.Vector getVariableQNames()
           
private static void p(java.lang.String s)
           
static void printDetails(org.w3c.dom.Node n)
           
 java.util.List selectNodes(org.w3c.dom.Node n, java.lang.String xpath)
          Evaluate an XPath expression to a List of nodes.
 org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node n, java.lang.String xpath)
          Evaluate an XPath expression to a single node.
private static void staticInit()
          Initialize globally useful data.
 java.lang.String valueOf(org.w3c.dom.Node n, java.lang.String xpath)
          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
 

Field Detail

globalVarSize

int globalVarSize

PAGE_NS_URL

private static final java.lang.String PAGE_NS_URL
See Also:
Constant Field Values

REQUEST_NS_URL

private static final java.lang.String REQUEST_NS_URL
See Also:
Constant Field Values

SESSION_NS_URL

private static final java.lang.String SESSION_NS_URL
See Also:
Constant Field Values

APP_NS_URL

private static final java.lang.String APP_NS_URL
See Also:
Constant Field Values

PARAM_NS_URL

private static final java.lang.String PARAM_NS_URL
See Also:
Constant Field Values

INITPARAM_NS_URL

private static final java.lang.String INITPARAM_NS_URL
See Also:
Constant Field Values

COOKIE_NS_URL

private static final java.lang.String COOKIE_NS_URL
See Also:
Constant Field Values

HEADER_NS_URL

private static final java.lang.String HEADER_NS_URL
See Also:
Constant Field Values

PAGE_P

private static final java.lang.String PAGE_P
See Also:
Constant Field Values

REQUEST_P

private static final java.lang.String REQUEST_P
See Also:
Constant Field Values

SESSION_P

private static final java.lang.String SESSION_P
See Also:
Constant Field Values

APP_P

private static final java.lang.String APP_P
See Also:
Constant Field Values

PARAM_P

private static final java.lang.String PARAM_P
See Also:
Constant Field Values

INITPARAM_P

private static final java.lang.String INITPARAM_P
See Also:
Constant Field Values

COOKIE_P

private static final java.lang.String COOKIE_P
See Also:
Constant Field Values

HEADER_P

private static final java.lang.String HEADER_P
See Also:
Constant Field Values

pageContext

private javax.servlet.jsp.PageContext pageContext

exprCache

private static java.util.HashMap exprCache

jstlPrefixResolver

private static JSTLPrefixResolver jstlPrefixResolver

dbf

static javax.xml.parsers.DocumentBuilderFactory dbf

db

static javax.xml.parsers.DocumentBuilder db

d

static org.w3c.dom.Document d

modifiedXPath

java.lang.String modifiedXPath
Constructor Detail

XPathUtil

public XPathUtil(javax.servlet.jsp.PageContext pc)
Constructs a new XPathUtil object associated with the given PageContext.

Method Detail

getVariableQNames

public java.util.Vector getVariableQNames()

staticInit

private static void staticInit()
Initialize globally useful data.


getDummyDocument

static org.w3c.dom.Document getDummyDocument()

getDummyDocumentWithoutRoot

static org.w3c.dom.Document getDummyDocumentWithoutRoot()

getDocumentForNode

private static org.w3c.dom.Document getDocumentForNode(org.w3c.dom.Node node)

valueOf

public java.lang.String valueOf(org.w3c.dom.Node n,
                                java.lang.String xpath)
                         throws javax.servlet.jsp.JspTagException
Evaluate an XPath expression to a String value.


booleanValueOf

public boolean booleanValueOf(org.w3c.dom.Node n,
                              java.lang.String xpath)
                       throws javax.servlet.jsp.JspTagException
Evaluate an XPath expression to a boolean value.


selectNodes

public java.util.List selectNodes(org.w3c.dom.Node n,
                                  java.lang.String xpath)
                           throws javax.servlet.jsp.JspTagException
Evaluate an XPath expression to a List of nodes.


selectSingleNode

public org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node n,
                                         java.lang.String xpath)
                                  throws javax.servlet.jsp.JspTagException
Evaluate an XPath expression to a single node.


getLocalContext

private org.apache.xpath.VariableStack getLocalContext()
Returns a locally appropriate context given a node.


adaptParamsForXalan

protected org.w3c.dom.Node adaptParamsForXalan(XPathUtil.JstlVariableContext jvc,
                                               org.w3c.dom.Node n,
                                               java.lang.String xpath)
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)


fillVarStack

private java.util.Vector fillVarStack(XPathUtil.JstlVariableContext vs,
                                      org.apache.xpath.XPathContext xpathSupport)
                               throws javax.servlet.jsp.JspTagException

getContext

public static org.w3c.dom.Node getContext(javax.servlet.jsp.tagext.Tag t)
                                   throws javax.servlet.jsp.JspTagException

p

private static void p(java.lang.String s)

printDetails

public static void printDetails(org.w3c.dom.Node n)