use of org.eclipse.wst.xml.xpath2.processor.internal.ast.PrimaryExpr in project webtools.sourceediting by eclipse.
the class LiteralsTest method test_Literals057.
// Test for string literal containing the predefined entity reference '"'.
public void test_Literals057() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals057.xq";
String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals057.txt";
String expectedResult = getExpectedResultNoEscape(resultFile);
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpressionNoEscape(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_Literals039.
// Test for invalid decimal literal.
public void test_Literals039() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals039.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_Literals033.
// Test for valid double literal.
public void test_Literals033() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals033.xq";
String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals033.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 LiteralsTest method test_Literals058.
// Test for string literal containing the predefined entity reference '''.
public void test_Literals058() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals058.xq";
String resultFile = "/ExpectedTestResults/Expressions/PrimaryExpr/Literals/Literals058-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 = 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_Literals008.
// Incorrectly terminated string literal.
public void test_Literals008() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PrimaryExpr/Literals/Literals008.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);
}
Aggregations