You may use the builtin xpath engine to evaluate your own xpath expressions any time in your code. The following examples shows how the xpath engine is used within an own action implementation.
This implementation will address all list items underneath which matches a certain pattern. The pattern is based on a field value from another type.
Unable to render embedded object: File (worddav2f51b87e377051db4caf28225cc7f883.png) not found. com.jaxfront.demo.api.XPathAction
public class XPathAction implements Action {
public void perform(Type source) {
Type patternType = source.getChild("simpleGroup").getDirectChild("A");
String pattern = source.getChild("simpleGroup").getDirectChildValue("A");
String xpath = ".//A[.='" + pattern + "']";
ListType listType = (ListType)source.getDirectChild("list");
List found = TypePathExecuter.getInstance().processXPath(listType, xpath);
AbstractView view = (AbstractView)TypeVisualizerFactory.getInstance().getVisualizer(patternType);
String message = "Found (" + found.size() + " items) for XPath ("+ xpath + "). Going to delete them...";
view.showHint(message, false, Color.RED, true);
Iterator iterator = found.iterator();
while (iterator.hasNext()) {
listType.removeChild(((Type)iterator.next()).getParent());
}
}
}