use of org.eclipse.wst.xml.xpath2.processor.internal.ast.RangeExpr in project webtools.sourceediting by eclipse.
the class DefaultEvaluator method visit.
/**
* visit range expression
*
* @param rex
* is the range expression.
* @return a new function
*/
public Object visit(RangeExpr rex) {
ResultSequence one = (ResultSequence) rex.left().accept(this);
ResultSequence two = (ResultSequence) rex.right().accept(this);
if (one.empty() || two.empty())
return ResultSequenceFactory.create_new();
Collection args = new ArrayList();
args.add(one);
args.add(two);
try {
return OpTo.op_to(args);
} catch (DynamicError err) {
report_error(err);
// unreach
return null;
}
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.RangeExpr in project webtools.sourceediting by eclipse.
the class RangeExprTest method test_rangeExpr_8.
// Evaluation of a range expression, where both operands are negative integers.
public void test_rangeExpr_8() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-8.xq";
String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-8.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.RangeExpr in project webtools.sourceediting by eclipse.
the class RangeExprTest method test_rangeExpr_25.
// Evaluation of a range expression, where the first operand is a division operation.
public void test_rangeExpr_25() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-25.xq";
String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-25.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.RangeExpr in project webtools.sourceediting by eclipse.
the class RangeExprTest method test_rangeExpr_14.
// Evaluation of a range expression, using the "fn:min" and "fn:max" functions.
public void test_rangeExpr_14() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-14.xq";
String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-14.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.RangeExpr in project webtools.sourceediting by eclipse.
the class RangeExprTest method test_rangeExpr_13.
// Evaluation of a range expression, using the "fn:max" function.
public void test_rangeExpr_13() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-13.xq";
String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-13.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = buildResultString(rs);
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
Aggregations