|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object se.kb.xml.XPathWrapper
public class XPathWrapper
Helper class that eases the job of handling XPath queries and
getting the different results. It wraps a Node
and then performs the XPath queries on that.
Constructor Summary | |
---|---|
XPathWrapper(Node node)
Wraps a Node for easier XPath handling. |
|
XPathWrapper(Node node,
Map<String,String> namespaces)
Creates a XPathWrapper that should be aware of all
the namespaces in the Map when handling XPath queries. |
Method Summary | |
---|---|
void |
addNamespace(String prefix,
String uri)
Adds a namespace that the wrapper should be aware of when performing XPath queries. |
List<Node> |
selectNodes(String xpathExpression)
Selects all Nodes that matches the given XPath. |
Element |
selectSingleElement(String xpathExpression)
Selects a single result that matches the given XPath and then casts it into a Element . |
Node |
selectSingleNode(String xpathExpression)
Selects a single node that matches the given XPath. |
String |
valueOf(String xpathExpression)
Selects the value of the given XPath. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XPathWrapper(Node node)
Node
for easier XPath handling.
node
- the Node
to wrappublic XPathWrapper(Node node, Map<String,String> namespaces)
XPathWrapper
that should be aware of all
the namespaces in the Map when handling XPath queries.
node
- the Node
to wrapnamespaces
- the namespacesMethod Detail |
---|
public void addNamespace(String prefix, String uri)
prefix
- the prefix of the namespaceuri
- the uri of the namespacepublic Node selectSingleNode(String xpathExpression)
xpathExpression
- the xpath
Node
or null
if no matchpublic List<Node> selectNodes(String xpathExpression)
Nodes
that matches the given XPath.
xpathExpression
- the xpath
public Element selectSingleElement(String xpathExpression)
Element
.
xpathExpression
- the xpath
Element
or null
if no matchpublic String valueOf(String xpathExpression)
xpathExpression
- the xpath
null
if no match
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |