use of org.eclipse.wst.xml.xpath2.processor.StaticNameResolver in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathWTPTest method compileXPath.
protected XPath compileXPath(DynamicContext dc, String xpath) throws XPathParserException, StaticError {
XPathParser xpp = new JFlexCupParser();
XPath path = xpp.parse(xpath);
StaticChecker name_check = new StaticNameResolver(dc);
name_check.check(path);
return path;
}
use of org.eclipse.wst.xml.xpath2.processor.StaticNameResolver in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathWTPTest method compileXPath.
protected XPath compileXPath(DynamicContext dc, String xpath, boolean isRootlessAccess) throws XPathParserException, StaticError {
XPathParser xpp = new JFlexCupParser();
XPath path = null;
if (isRootlessAccess) {
path = xpp.parse(xpath, isRootlessAccess);
} else {
path = xpp.parse(xpath);
}
StaticChecker name_check = new StaticNameResolver(dc);
name_check.check(path);
return path;
}
use of org.eclipse.wst.xml.xpath2.processor.StaticNameResolver in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathTest method compileXPath.
protected XPath compileXPath(String xpath, boolean isRootlessAccess) throws XPathParserException, StaticError {
XPathParser xpp = new JFlexCupParser();
XPath path = null;
if (isRootlessAccess) {
path = xpp.parse(xpath, isRootlessAccess);
} else {
path = xpp.parse(xpath);
}
StaticChecker name_check = new StaticNameResolver(dynamicContext);
name_check.check(path);
return path;
}
use of org.eclipse.wst.xml.xpath2.processor.StaticNameResolver in project webtools.sourceediting by eclipse.
the class AbstractPsychoPathTest method compileXPath.
protected XPath compileXPath(String xpath) throws XPathParserException, StaticError {
if (useNewApi) {
newXPath = new Engine().parseExpression(xpath, staticContextBuilder);
return null;
} else {
XPathParser xpp = new JFlexCupParser();
XPath path = oldXPath = xpp.parse(xpath);
StaticChecker name_check = new StaticNameResolver(dynamicContext);
name_check.check(path);
return path;
}
}
use of org.eclipse.wst.xml.xpath2.processor.StaticNameResolver in project webtools.sourceediting by eclipse.
the class StaticContextAdapterTest method testFunctionCall.
public void testFunctionCall() {
XPathParser xpp = new JFlexCupParser();
XPath xpath = xpp.parse("fn:sum((1,2,3))");
DefaultStaticContext sc = new DefaultStaticContext(null);
sc.add_namespace("fn", "http://www.w3.org/2005/xpath-functions");
sc.add_function_library(new FnFunctionLibrary());
StaticChecker namecheck = new StaticNameResolver(sc);
namecheck.check(xpath);
DefaultDynamicContext dc = new DefaultDynamicContext(null, null);
dc.add_namespace("fn", "http://www.w3.org/2005/xpath-functions");
dc.add_function_library(new FnFunctionLibrary());
Evaluator eval = new DefaultEvaluator(dc, null);
ResultSequence rs = eval.evaluate(xpath);
assertEquals(1, rs.size());
XSDecimal result = (XSDecimal) rs.first();
String actual = result.getStringValue();
assertEquals("6", actual);
}
Aggregations