Exemplo n.º 1
0
 /** {@inheritDoc} */
 @Override
 @SuppressWarnings("unchecked")
 public List<Node> evaluate(Node node, RuleContext data) {
   List<Node> results = new ArrayList<Node>();
   try {
     initializeXPathExpression(
         data.getLanguageVersion().getLanguageVersionHandler().getXPathHandler().getNavigator());
     List<XPath> xpaths = nodeNameToXPaths.get(node.toString());
     if (xpaths == null) {
       xpaths = nodeNameToXPaths.get(AST_ROOT);
     }
     for (XPath xpath : xpaths) {
       List<Node> nodes = xpath.selectNodes(node);
       results.addAll(nodes);
     }
   } catch (JaxenException ex) {
     throw new RuntimeException(ex);
   }
   return results;
 }
Exemplo n.º 2
0
 @Override
 public String getLocalPart() {
   return node.toString();
 }