net.sf.swan.xpath
Class XPathSupport
java.lang.Object
|
+--net.sf.swan.xpath.XPathSupport
- Direct Known Subclasses:
- Matcher, Selector
- public class XPathSupport
- extends java.lang.Object
Method Summary |
protected org.jaxen.ContextSupport |
createContextSupport()
|
protected org.jaxen.FunctionContext |
createFunctionContext()
|
protected MatchContext |
createMatchContext()
|
Matcher |
createMatcher()
Create a Matcher with a copy of this object's context. |
protected org.jaxen.NamespaceContext |
createNamespaceContext()
|
Selector |
createSelector()
Create a Selector with a copy of this object's context. |
protected org.jaxen.VariableContext |
createVariableContext()
|
protected org.jaxen.ContextSupport |
getContextSupport()
|
java.lang.Object |
getDocument(java.lang.String uri)
Retrieves a document object from the specified URI. |
org.jaxen.FunctionContext |
getFunctionContext()
|
org.jaxen.Navigator |
getNavigator()
|
protected org.saxpath.XPathReader |
getReader()
|
protected java.lang.Object |
getVariableValue(net.sf.swan.xpath.QualifiedName key)
|
java.lang.Object |
getVariableValue(java.lang.String qName)
Retrieves the variable with the specified qualified name. |
java.lang.Object |
getVariableValue(java.lang.String namespaceUri,
java.lang.String localName)
Retrieves the variable with the specified namespace and local name. |
java.util.Map |
keyMap(java.lang.Object rootNode,
java.lang.String pattern,
java.lang.String use)
Creates an XSLT-like key map. |
protected org.jaxen.expr.Expr |
parseAVT(java.lang.String expr)
|
protected org.jaxen.expr.Expr |
parseAVT(java.lang.String expr,
java.lang.Object contextNode)
|
protected Pattern[] |
parsePattern(java.lang.String expr)
|
protected Pattern[] |
parsePattern(java.lang.String expr,
java.lang.Object contextNode)
|
protected org.jaxen.expr.Expr |
parseXPath(java.lang.String expr)
|
protected org.jaxen.expr.Expr |
parseXPath(java.lang.String expr,
java.lang.Object contextNode)
|
void |
putNamespace(java.lang.String prefix,
java.lang.String uri)
|
void |
putVariableValue(java.lang.String qName,
java.lang.Object value)
|
void |
putVariableValue(java.lang.String namespaceUri,
java.lang.String localName,
java.lang.Object value)
|
java.lang.String |
resolveNamespacePrefix(java.lang.String prefix)
|
void |
setFunctionContext(org.jaxen.FunctionContext context)
|
void |
setNavigator(org.jaxen.Navigator navigator)
Sets the Navigator for use by the component. |
protected boolean |
toBoolean(java.lang.Object obj)
|
protected java.util.List |
toList(java.lang.Object obj)
|
protected java.lang.Object |
toSingle(java.lang.Object obj)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
verifyVars
protected boolean verifyVars
defaultParseAdapter
protected net.sf.swan.xpath.XPathSupport.ParseAdapter defaultParseAdapter
XPathSupport
public XPathSupport()
XPathSupport
public XPathSupport(org.jaxen.Navigator navigator)
- Initializes this XPathSupport with the given
Navigator
.
- See Also:
setNavigator(org.jaxen.Navigator)
XPathSupport
protected XPathSupport(XPathSupport prototype)
getDocument
public java.lang.Object getDocument(java.lang.String uri)
throws org.jaxen.JaxenException
- Retrieves a document object from the specified URI. The
object representation returned will depend upon the
particular
Navigator
in use.
getNavigator
public org.jaxen.Navigator getNavigator()
setNavigator
public void setNavigator(org.jaxen.Navigator navigator)
- Sets the
Navigator
for use by the component.
If no Navigator
is explicitly provided,
a default one will be created that uses the
DOM.
resolveNamespacePrefix
public java.lang.String resolveNamespacePrefix(java.lang.String prefix)
putNamespace
public void putNamespace(java.lang.String prefix,
java.lang.String uri)
getFunctionContext
public org.jaxen.FunctionContext getFunctionContext()
setFunctionContext
public void setFunctionContext(org.jaxen.FunctionContext context)
getVariableValue
public java.lang.Object getVariableValue(java.lang.String namespaceUri,
java.lang.String localName)
- Retrieves the variable with the specified namespace and local name.
- Returns:
- the variable value, or
null
if the variable
has not been set
getVariableValue
public java.lang.Object getVariableValue(java.lang.String qName)
- Retrieves the variable with the specified qualified name.
- Returns:
- the variable value, or
null
if the variable
has not been set
putVariableValue
public void putVariableValue(java.lang.String namespaceUri,
java.lang.String localName,
java.lang.Object value)
putVariableValue
public void putVariableValue(java.lang.String qName,
java.lang.Object value)
createSelector
public Selector createSelector()
- Create a Selector with a copy of this object's context. This
includes all namespace bindings and variables, and the
associated
FunctionContext
.
createMatcher
public Matcher createMatcher()
- Create a Matcher with a copy of this object's context. This
includes all namespace bindings, functions, and variables.
keyMap
public java.util.Map keyMap(java.lang.Object rootNode,
java.lang.String pattern,
java.lang.String use)
throws org.saxpath.SAXPathException
- Creates an XSLT-like key map. This will recurse through
the descendant hierarchy below the specified root node
identifying each element that matches the provided pattern.
For each such node, the "use" XPath expression
is used to select a string identifier, and the element
is stored in the map with the identifier as it's key.
- Parameters:
rootNode
- the root node from which to being searchingpattern
- the XSLT pattern identifying elements to be
stored in the mapuse
- an XPath expression to apply to each matching
element to select its key
getVariableValue
protected java.lang.Object getVariableValue(net.sf.swan.xpath.QualifiedName key)
getContextSupport
protected org.jaxen.ContextSupport getContextSupport()
createContextSupport
protected org.jaxen.ContextSupport createContextSupport()
createFunctionContext
protected org.jaxen.FunctionContext createFunctionContext()
createNamespaceContext
protected org.jaxen.NamespaceContext createNamespaceContext()
createVariableContext
protected org.jaxen.VariableContext createVariableContext()
createMatchContext
protected MatchContext createMatchContext()
getReader
protected org.saxpath.XPathReader getReader()
throws org.saxpath.SAXPathException
parseXPath
protected org.jaxen.expr.Expr parseXPath(java.lang.String expr)
throws org.saxpath.SAXPathException
parseXPath
protected org.jaxen.expr.Expr parseXPath(java.lang.String expr,
java.lang.Object contextNode)
throws org.saxpath.SAXPathException
parseAVT
protected org.jaxen.expr.Expr parseAVT(java.lang.String expr)
throws org.saxpath.SAXPathException
parseAVT
protected org.jaxen.expr.Expr parseAVT(java.lang.String expr,
java.lang.Object contextNode)
throws org.saxpath.SAXPathException
parsePattern
protected Pattern[] parsePattern(java.lang.String expr)
throws org.saxpath.SAXPathException
parsePattern
protected Pattern[] parsePattern(java.lang.String expr,
java.lang.Object contextNode)
throws org.saxpath.SAXPathException
toList
protected java.util.List toList(java.lang.Object obj)
toSingle
protected java.lang.Object toSingle(java.lang.Object obj)
toBoolean
protected boolean toBoolean(java.lang.Object obj)