|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.canoo.webtest.engine.xpath.XPathHelper
public class XPathHelper
Helper class for a central XPath creation allowing to share variable, function and namespace contexts. TODO: cleanup to use plainly javax.xml.xpath.*
| Constructor Summary | |
|---|---|
XPathHelper()
Initializes from the global functions, variables and namespaces. |
|
| Method Summary | |
|---|---|
protected Object |
getByXPath(com.gargoylesoftware.htmlunit.Page _currentResp,
String _xpath,
boolean _onlyFirstResult)
|
protected Object |
getDocument(com.gargoylesoftware.htmlunit.Page page)
Gets the document object associated to the page that could be provided to the XPath for computations |
SimpleXPathFunctionResolver |
getFunctionContext()
Gets the function resolver used during XPath evaluation for this webtest. |
static Map<javax.xml.namespace.QName,Class<? extends org.apache.xpath.functions.Function>> |
getGlobalFunctions()
Gets the registered global functions. |
static Map<String,String> |
getGlobalNamespaces()
Gets the registered global namespaces. |
static Map<javax.xml.namespace.QName,Object> |
getGlobalVariables()
Gets the registered global variables. |
SimpleNamespaceContext |
getNamespaceContext()
Gets the namespace context used for namespace resolution during XPath evaluation for this webtest. |
SimpleXPathVariableResolver |
getVariableContext()
Gets the variable context used for variable resolution (the $foo in an xpath expression) during XPath evaluation for this webtest. |
static String |
quote(String value)
Quotes the provided value, handling quotes and double quotes if needed to |
static void |
registerGlobalFunction(String namespaceURI,
String localName,
Class<? extends org.apache.xpath.functions.Function> function)
Registers a global function. |
static void |
registerGlobalNamespace(String prefix,
String namespaceURI)
Registers a global namespace. |
static void |
registerGlobalVariable(String namespaceURI,
String localName,
Object value)
Registers a global variable. |
Object |
selectFirst(com.gargoylesoftware.htmlunit.Page _page,
String _xpath)
|
List<? extends Object> |
selectNodes(com.gargoylesoftware.htmlunit.Page _page,
String _xpath)
|
String |
stringValueOf(com.gargoylesoftware.htmlunit.Page _page,
String _xpath)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XPathHelper()
| Method Detail |
|---|
public static void registerGlobalVariable(String namespaceURI,
String localName,
Object value)
namespaceURI - the namespace URI of the function to be registered (null
if none).localName - the non-prefixed local portion of the function name to
be registeredvalue - the variable to be registeredpublic static Map<javax.xml.namespace.QName,Object> getGlobalVariables()
public static Map<javax.xml.namespace.QName,Class<? extends org.apache.xpath.functions.Function>> getGlobalFunctions()
public static Map<String,String> getGlobalNamespaces()
public static void registerGlobalFunction(String namespaceURI,
String localName,
Class<? extends org.apache.xpath.functions.Function> function)
namespaceURI - the namespace URI of the function to be registered (null
if none).localName - the non-prefixed local portion of the function name to
be registeredfunction - the function to be registered
public static void registerGlobalNamespace(String prefix,
String namespaceURI)
prefix - the namespace prefix to resolvenamespaceURI - the namespace URIpublic SimpleXPathFunctionResolver getFunctionContext()
public SimpleNamespaceContext getNamespaceContext()
public SimpleXPathVariableResolver getVariableContext()
protected Object getDocument(com.gargoylesoftware.htmlunit.Page page)
page - the page
public String stringValueOf(com.gargoylesoftware.htmlunit.Page _page,
String _xpath)
throws javax.xml.xpath.XPathExpressionException
javax.xml.xpath.XPathExpressionException
public List<? extends Object> selectNodes(com.gargoylesoftware.htmlunit.Page _page,
String _xpath)
throws javax.xml.xpath.XPathExpressionException
javax.xml.xpath.XPathExpressionException
public Object selectFirst(com.gargoylesoftware.htmlunit.Page _page,
String _xpath)
throws javax.xml.xpath.XPathExpressionException
javax.xml.xpath.XPathExpressionException
protected Object getByXPath(com.gargoylesoftware.htmlunit.Page _currentResp,
String _xpath,
boolean _onlyFirstResult)
throws javax.xml.xpath.XPathExpressionException
javax.xml.xpath.XPathExpressionExceptionpublic static String quote(String value)
value - the value to quote
|
Copyright © 2001-2007 Canoo Engineering AG, Basel. All rights reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||