public class JaxenConditionFactory implements ConditionFactory {
public Condition[] newCondition(Rule rule, RuleBaseContext ruleBaseContext, Configuration configuration) throws FactoryException {
String text = configuration.getText();
if (text == null) {
throw new FactoryException("No XPath provided!");
}
try {
JaxenXPathExpression expression = new JaxenXPathExpression();
expression.setXpath(text);
expression.setNamespaceContext(createNamespaceContext(configuration));
expression.afterPropertiesSet();
return new Condition[]{ new JaxenCondition(rule, expression) };
}
catch (Exception e) {
throw new FactoryException(e);
}
}