use of org.eclipse.wst.xml.xpath2.processor.internal.ast.ForExpr in project webtools.sourceediting by eclipse.
the class ForExprWithoutTest method test_ForExpr018.
// Multiple in statements for single variable binding.
public void test_ForExpr018() throws Exception {
String inputFile = "/TestSources/fsx.xml";
String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr018.xq";
String expectedResult = "XPST0003";
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.ForExpr in project webtools.sourceediting by eclipse.
the class ForExprWithoutTest method test_ForExpr009.
// For+Return - error, use variable in it's own declaration.
public void test_ForExpr009() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr009.xq";
String expectedResult = "XPST0008";
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 = buildXMLResultString(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.ForExpr in project webtools.sourceediting by eclipse.
the class ForExprWithoutTest method test_ForExpr015.
// Return expression contains nested for expression.
public void test_ForExpr015() throws Exception {
String inputFile = "/TestSources/fsx.xml";
String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr015.xq";
String resultFile = "/ExpectedTestResults/Expressions/FLWORExpr/ForExpr/ForExpr015.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.ForExpr in project webtools.sourceediting by eclipse.
the class ForExprWithoutTest method test_ForExpr017.
// Multiple return statements from single for expression.
public void test_ForExpr017() throws Exception {
String inputFile = "/TestSources/fsx.xml";
String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr017.xq";
String expectedResult = "XPST0003";
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.ForExpr in project webtools.sourceediting by eclipse.
the class ForExprWithoutTest method test_ForExpr016.
// Interate over nodes in document and constant sequence. Return value based on both.
public void test_ForExpr016() throws Exception {
String inputFile = "/TestSources/fsx.xml";
String xqFile = "/Queries/XQuery/Expressions/FLWORExpr/ForExpr/ForExpr016.xq";
String resultFile = "/ExpectedTestResults/Expressions/FLWORExpr/ForExpr/ForExpr016.xml";
String expectedResult = "<result>" + getExpectedResult(resultFile) + "</result>";
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 = "<result>" + buildXMLResultString(rs) + "</result>";
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
} catch (DynamicError ex) {
actual = ex.code();
}
assertXMLEqual("XPath Result Error " + xqFile + ":", expectedResult, actual);
}
Aggregations