Class XStreamSafeEvaluator

java.lang.Object
org.kuali.rice.kew.xml.xstream.XStreamSafeEvaluator

public class XStreamSafeEvaluator extends Object
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:
<test>
   <a>hello</a>
   <b>
     <a reference="../../a"/>
   </b>
 </test>

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())

Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Constructor Details

    • XStreamSafeEvaluator

      public XStreamSafeEvaluator()
    • XStreamSafeEvaluator

      public XStreamSafeEvaluator(XPath xpath)
  • Method Details

    • evaluate

      public NodeList evaluate(String xPathExpression, Node rootSearchNode) throws XPathExpressionException
      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.
      Throws:
      XPathExpressionException - if there was a problem evaluation the XPath expression.
    • getXpath

      public XPath getXpath()
    • setXpath

      public void setXpath(XPath xpath)