|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.tum.cs.commons.xml.XPathEvaluator
public class XPathEvaluator
Evaluator for XPath expression. This is preferable to using the normal
XPath class as it has built-in support for namespace-handling and the
evaluation-method does not define exceptions.
| Constructor Summary | |
|---|---|
XPathEvaluator()
Create new evaluator. |
|
| Method Summary | |
|---|---|
void |
addNamespace(String prefix,
String uri)
Add a namespace. |
Object |
select(String expr,
Element context,
QName returnType)
Evaluates an XPath expression on context element. |
boolean |
selectBoolean(String expr,
Element context)
Evaluates an XPath expression on context element. |
double |
selectDouble(String expr,
Element context)
Evaluates an XPath expression on context element. |
Element |
selectElement(String expr,
Element context)
Evaluates an XPath expression on context element. |
int |
selectInt(String expr,
Element context)
Evaluates an XPath expression on context element. |
List<Element> |
selectList(String expr,
Element context)
Evaluates an XPath expression on context element. |
NodeList |
selectNodeList(String expr,
Element context)
Evaluates an XPath expression on context element. |
String |
selectString(String expr,
Element context)
Evaluates an XPath expression on context element. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XPathEvaluator()
| Method Detail |
|---|
public void addNamespace(String prefix,
String uri)
public Object select(String expr,
Element context,
QName returnType)
AssertionError otherwise.
returnType - use XPathConstants to define return type.
public List<Element> selectList(String expr,
Element context)
AssertionError otherwise.
public NodeList selectNodeList(String expr,
Element context)
AssertionError otherwise.
public Element selectElement(String expr,
Element context)
AssertionError otherwise.
public String selectString(String expr,
Element context)
AssertionError otherwise.
public double selectDouble(String expr,
Element context)
AssertionError otherwise.
Due to the implementation of XPath this returns 0.0 if the
element was not found.
public int selectInt(String expr,
Element context)
AssertionError otherwise.
Due to the implementation of XPath this returns 0 if the element
was not found.
public boolean selectBoolean(String expr,
Element context)
AssertionError otherwise.
Due to the implementation of XPath this returns
false if the element was not found.
|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||