|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.kew.xml.xstream.XStreamSafeEvaluator
public class XStreamSafeEvaluator
Evaluates simple XPath expressions to follow paths through a document generated by XStream which uses "reference" elements to handle circular and duplicate references. For example, an XML document generated from XStream might look like the following:
hello
In the above case, the XPath expression /test/a would result in the "hello" text but the XPath expression /test/b/a would result in the empty string. However, if the evaluator below is mapped as an XPath function, than it could be used as follows on the second expression to produce the desired result of "hello": xstreamsafe('/test/b/a', root())
Nested Class Summary | |
---|---|
private class |
XStreamSafeEvaluator.SimpleNodeList
A simple NodeList implementation, as simple as it gets. |
private class |
XStreamSafeEvaluator.XPathSegment
A single segment of an XPath expression. |
Field Summary | |
---|---|
private static String |
MATCH_ANY
|
private static String |
MATCH_CURRENT
|
private static String |
MATCH_ROOT
|
private XPath |
xpath
|
private static String |
XSTREAM_REFERENCE_ATTRIBUTE
|
Constructor Summary | |
---|---|
XStreamSafeEvaluator()
|
|
XStreamSafeEvaluator(XPath xpath)
|
Method Summary | |
---|---|
NodeList |
evaluate(String xPathExpression,
Node rootSearchNode)
Evaluates the given XPath expression against the given Node while following reference attributes on Nodes in a way which is compatible with the XStream library. |
XPath |
getXpath()
|
private void |
parseExpression(List segments,
String xPathExpression,
boolean isInitialSegment)
Parses the given XPath expression into a List of segments which can be evaluated in order. |
private XStreamSafeEvaluator.XPathSegment |
parseInitialSegment(String xPathExpression)
Parses the next segment of the given XPath expression by grabbing the first segment off of the given xpath expression. |
private XStreamSafeEvaluator.XPathSegment |
parseNextSegment(String xPathExpression)
Parses the next segment of the given XPath expression by grabbing the first segment off of the given xpath expression. |
private Node |
resolveNodeReference(XPath xpath,
Node node)
Resolves the reference to a Node by checking for a "reference" attribute and returning the resolved node if it's there. |
void |
setXpath(XPath xpath)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final String MATCH_ANY
private static final String MATCH_ROOT
private static final String MATCH_CURRENT
private static final String XSTREAM_REFERENCE_ATTRIBUTE
private XPath xpath
Constructor Detail |
---|
public XStreamSafeEvaluator()
public XStreamSafeEvaluator(XPath xpath)
Method Detail |
---|
public NodeList evaluate(String xPathExpression, Node rootSearchNode) throws XPathExpressionException
XPathExpressionException
- if there was a problem evaluation the XPath expression.private void parseExpression(List segments, String xPathExpression, boolean isInitialSegment) throws XPathExpressionException
XPathExpressionException
private XStreamSafeEvaluator.XPathSegment parseInitialSegment(String xPathExpression) throws XPathExpressionException
XPathExpressionException
private XStreamSafeEvaluator.XPathSegment parseNextSegment(String xPathExpression) throws XPathExpressionException
XPathExpressionException
private Node resolveNodeReference(XPath xpath, Node node) throws XPathExpressionException
XPathExpressionException
public XPath getXpath()
public void setXpath(XPath xpath)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |