use of org.eclipse.wst.xml.xpath2.processor.internal.ast.NodeTest in project webtools.sourceediting by eclipse.
the class NameTestTest method test_nametest_4.
// Name test that uses an unknown prefix. Uses "*".
public void test_nametest_4() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/NodeTest/nametest-4.xq";
String expectedResult = "XPST0081";
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
xpath = "./child::pr:*";
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.NodeTest in project webtools.sourceediting by eclipse.
the class NameTestTest method test_NodeTest003.
// Simple test for * node test.
public void test_NodeTest003() throws Exception {
String inputFile = "/TestSources/nw_Customers.xml";
String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/NodeTest/NodeTest003.xq";
String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/NodeTest/NodeTest003.xml";
String expectedResult = formatResultString(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.processor.internal.ast.NodeTest in project webtools.sourceediting by eclipse.
the class NodeTestTest method test_NodeTest012_2.
// processing-instruction() gets all PIs, including those off root.
public void test_NodeTest012_2() throws Exception {
String inputFile = "/TestSources/TopMany.xml";
String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/NodeTest/NodeTest012.xq";
String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/NodeTest/NodeTest012-2.xml";
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 = "fn:count($input-context//processing-instruction())";
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = "<out>" + buildResultString(rs) + "</out>";
} 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.NodeTest in project webtools.sourceediting by eclipse.
the class NodeTestTest method test_NodeTest010_1.
// //comment() gets no comment nodes anywhere.
public void test_NodeTest010_1() throws Exception {
String inputFile = "/TestSources/TreeEmpty.xml";
String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/NodeTest/NodeTest010.xq";
String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/NodeTest/NodeTest010-1.xml";
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 = "fn:count($input-context//comment())";
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = "<out>" + buildResultString(rs) + "</out>";
} 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.NodeTest in project webtools.sourceediting by eclipse.
the class NodeTestTest method test_NodeTest007_1.
// processing-instruction() finds no descendant PIs of the given name anywhere.
public void test_NodeTest007_1() throws Exception {
String inputFile = "/TestSources/TreeEmpty.xml";
String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/NodeTest/NodeTest007.xq";
String resultFile = "/ExpectedTestResults/Expressions/PathExpr/Steps/NodeTest/NodeTest007-1.xml";
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 = "fn:count($input-context//processing-instruction('a-pi'))";
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
actual = "<out>" + buildResultString(rs) + "</out>";
} 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