public class TapestryXPath
extends org.jaxen.BaseXPath
implements org.jaxen.XPath
Constructor and Description |
---|
TapestryXPath(String xpath) |
Modifier and Type | Method and Description |
---|---|
List<String> |
normalizedDescendantText(Object node)
Selects nodes and then, for each node found, concatenates all the descendant
text nodes and applies
normalizeText(String) . |
static String |
normalizeText(String text)
Normalises text from the DOM so that is more like what is displayed to a user by a browser
(for Latin scripts):
whitespace is replaced with space, multiple space is collapsed into single spaces and any space at
the beginning or end is trimmed.
|
List<org.apache.tapestry5.dom.Attribute> |
selectAttributes(Object node)
As
selectNodes(Object) but assumes the result will be a collection of
Attributes. |
List<org.apache.tapestry5.dom.Element> |
selectElements(Object node)
As
selectNodes(Object) but assumes the result will be a collection of
Elements. |
List<String> |
selectElementsAttribute(Object node,
String attributeName)
Returns the
Element.getAttribute(String) from each element identified by selectElements(Object) . |
List<String> |
selectElementsChildMarkup(Object node)
Returns the
Element.getChildMarkup() from each element identified by selectElements(Object) . |
List<org.apache.tapestry5.dom.Node> |
selectNodes(Object node) |
org.apache.tapestry5.dom.Element |
selectSingleElement(Object node)
As
BaseXPath.selectSingleNode(Object) but assumes the result will be an Element. |
String |
singleNormalizedDescendantText(Object node)
Selects a single node and then concatenates all the descendant text nodes and
applies
normalizeText(String) . |
List<String> |
stringValuesOf(Object node)
As
selectNodes(Object) but converts each of the selected nodes into its XPath string-value. |
static TapestryXPath |
xpath(String xpath)
Creates a new TapestryXPath object.
|
addNamespace, booleanValueOf, createFunctionContext, createNamespaceContext, createVariableContext, debug, evaluate, getContext, getContextSupport, getFunctionContext, getNamespaceContext, getNavigator, getRootExpr, getVariableContext, numberValueOf, selectNodesForContext, selectSingleNode, selectSingleNodeForContext, setFunctionContext, setNamespaceContext, setVariableContext, stringValueOf, toString, valueOf
public TapestryXPath(String xpath) throws org.jaxen.JaxenException
org.jaxen.JaxenException
public static TapestryXPath xpath(String xpath) throws org.jaxen.JaxenException
xpath
- the XPath expression as a string (not null)org.jaxen.JaxenException
public List<org.apache.tapestry5.dom.Node> selectNodes(Object node) throws org.jaxen.JaxenException
selectNodes
in interface org.jaxen.XPath
selectNodes
in class org.jaxen.BaseXPath
org.jaxen.JaxenException
public List<org.apache.tapestry5.dom.Element> selectElements(Object node) throws org.jaxen.JaxenException
selectNodes(Object)
but assumes the result will be a collection of
Elements.org.jaxen.JaxenException
public List<org.apache.tapestry5.dom.Attribute> selectAttributes(Object node) throws org.jaxen.JaxenException
selectNodes(Object)
but assumes the result will be a collection of
Attributes.org.jaxen.JaxenException
public List<String> stringValuesOf(Object node) throws org.jaxen.JaxenException
selectNodes(Object)
but converts each of the selected nodes into its XPath string-value.org.jaxen.JaxenException
normalizedDescendantText(Object)
public List<String> selectElementsChildMarkup(Object node) throws org.jaxen.JaxenException
Element.getChildMarkup()
from each element identified by selectElements(Object)
.org.jaxen.JaxenException
public List<String> selectElementsAttribute(Object node, String attributeName) throws org.jaxen.JaxenException
Element.getAttribute(String)
from each element identified by selectElements(Object)
.
Note this is different from using XPath to match the attributes - if the attribute is missing then XPath can't match it
whereas this will include a "null" in the list.org.jaxen.JaxenException
public org.apache.tapestry5.dom.Element selectSingleElement(Object node) throws org.jaxen.JaxenException
BaseXPath.selectSingleNode(Object)
but assumes the result will be an Element.org.jaxen.JaxenException
public String singleNormalizedDescendantText(Object node) throws org.jaxen.JaxenException
normalizeText(String)
. Useful to get a sense of what would be
displayed as text to a user by a browser.org.jaxen.JaxenException
BaseXPath.selectSingleNode(Object)
public List<String> normalizedDescendantText(Object node) throws org.jaxen.JaxenException
normalizeText(String)
. Useful to get a sense of what would be
displayed as text to a user by a browser.org.jaxen.JaxenException
BaseXPath.selectSingleNode(Object)
public static String normalizeText(String text)
Copyright © 2009-2012. All Rights Reserved.