use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.
the class NodeNameFuncTest method test_fn_node_name_3.
// Evaluates the "node-name" function with argument set to an element node query from a file.
public void test_fn_node_name_3() throws Exception {
String inputFile = "/TestSources/works-mod.xml";
String xqFile = "/Queries/XQuery/Functions/AccessorFunc/NodeNameFunc/fn-node-name-3.xq";
String resultFile = "/ExpectedTestResults/Functions/AccessorFunc/NodeNameFunc/fn-node-name-3.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.api.Function in project webtools.sourceediting by eclipse.
the class NodeNameFuncTest method test_fn_node_name_2.
// Evaluates the "node-name" function with argument set to a comment node.
public void test_fn_node_name_2() throws Exception {
String inputFile = "/TestSources/works-mod.xml";
String xqFile = "/Queries/XQuery/Functions/AccessorFunc/NodeNameFunc/fn-node-name-2.xq";
String resultFile = "/ExpectedTestResults/Functions/AccessorFunc/NodeNameFunc/fn-node-name-2.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.api.Function in project webtools.sourceediting by eclipse.
the class PredicatesTest method test_predicates_13.
// Evaluation of a simple predicate, that uses the "xs:boolean()" function.
public void test_predicates_13() throws Exception {
String inputFile = "/TestSources/atomicns.xml";
String xqFile = "/Queries/XQuery/Expressions/PathExpr/Predicates/predicates-13.xq";
String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Predicates/predicates-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 = 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.api.Function in project webtools.sourceediting by eclipse.
the class PredicatesTest method test_predicatesns_14.
// Evaluation of a simple predicate, that uses the "xs:date()" function. Not Schema dependent.
public void test_predicatesns_14() throws Exception {
String inputFile = "/TestSources/atomicns.xml";
String xqFile = "/Queries/XQuery/Expressions/PathExpr/Predicates/predicatesns-14.xq";
String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Predicates/predicatesns-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 = 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.api.Function in project webtools.sourceediting by eclipse.
the class PredicatesTest method test_predicatesns_9.
// Evaluation of a simple predicate, that uses the "xs:integer()" function. Not Schema dependent.
public void test_predicatesns_9() throws Exception {
String inputFile = "/TestSources/atomicns.xml";
String xqFile = "/Queries/XQuery/Expressions/PathExpr/Predicates/predicatesns-9.xq";
String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Predicates/predicatesns-9.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 = 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);
}
Aggregations