List of usage examples for org.jdom2.xpath XPathExpression getNamespace
public Namespace getNamespace(String prefix);
From source file:org.xflatdb.xflat.util.XPathExpressionEqualityMatcher.java
License:Apache License
private static List<String> tokenizeExpression(XPathExpression<?> expression) { String exp = expression.getExpression(); List<String> ret = new ArrayList<>(); Matcher matcher = nsPattern.matcher(exp); int index = 0; while (matcher.find()) { if (matcher.start() > index) { ret.add(exp.substring(index, matcher.start() - index)); }//from w ww . ja va 2s .c om //translate namespace prefix to full ns String prefix = matcher.group(1); ret.add(expression.getNamespace(prefix).getURI()); index = matcher.end(); } if (index < exp.length()) { ret.add(exp.substring(index)); } return ret; }