use of org.eclipse.wst.xml.xpath2.processor.internal.ast.PrimaryExpr in project webtools.sourceediting by eclipse.
the class LiteralsTest method test_Literals044.
// Test for invalid double literal.
public void test_Literals044() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals044.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);
AnyType result = rs.first();
actual = result.getStringValue();
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error:", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.PrimaryExpr in project webtools.sourceediting by eclipse.
the class LiteralsTest method test_Literals020.
// Test for valid double literal.
public void test_Literals020() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals020.xq";
String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals020.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);
AnyType result = rs.first();
actual = result.getStringValue();
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error:", expectedResult, actual);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.ast.PrimaryExpr in project webtools.sourceediting by eclipse.
the class ParenExprTest method test_Parenexpr_5.
// Arithmetic operations.
public void test_Parenexpr_5() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-5.xq";
String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-5.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);
AnyType result = rs.first();
actual = result.getStringValue();
} 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.PrimaryExpr in project webtools.sourceediting by eclipse.
the class ParenExprTest method test_Parenexpr_9.
// Logical expressions.
public void test_Parenexpr_9() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/ParenExpr/Parenexpr-9.xq";
String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/ParenExpr/Parenexpr-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);
AnyType result = rs.first();
actual = result.getStringValue();
} 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.PrimaryExpr in project webtools.sourceediting by eclipse.
the class LiteralsTest method test_Literals068.
// Test the escaping of the ' (apostrophe) and " (quotation) characters as part of an XML text node constructor.
public void test_Literals068() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
// String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals068.xq";
String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals068-1.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 = "'He said, \"I don''t like it.\"'";
String actual = null;
try {
compileXPath(xpath);
ResultSequence rs = evaluate(domDoc);
AnyType result = rs.first();
actual = result.getStringValue();
} catch (XPathParserException ex) {
actual = ex.code();
} catch (StaticError ex) {
actual = ex.code();
}
assertEquals("XPath Result Error:", expectedResult, actual);
}
Aggregations