use of org.eclipse.wst.xml.xpath2.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class QNameEQTest method test_op_qname_equal_6.
// Evaluates the "op:qname-equal" operator used with simple different qname values (same namespace URI values, different local part). Uses the ne operator.
public void test_op_qname_equal_6() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/CompExpr/ValComp/QNameOp/QNameEQ/op-qname-equal-6.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/CompExpr/ValComp/QNameOp/QNameEQ/op-qName-equal-6.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.types.QName in project webtools.sourceediting by eclipse.
the class QNameEQTest method test_value_comparison_2.
// Evaluates value comparison between string and QName. Uses "ne" operator.
public void test_value_comparison_2() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/Operators/CompExpr/ValComp/QNameOp/QNameEQ/value-comparison-2.xq";
String resultFile = "/ExpectedTestResults/Expressions/Operators/CompExpr/ValComp/QNameOp/QNameEQ/value-comparison-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.processor.internal.types.QName in project webtools.sourceediting by eclipse.
the class SeqExprCastSITest method test_qname_cast_3.
// Evaluates casting QName derived type to another QName derived type.
public void test_qname_cast_3() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/SchemaImport/SeqExprCastSI/qname-cast-3.xq";
String resultFile = "/ExpectedTestResults/SchemaImport/SeqExprCastSI/value1.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
Schema jaxpSchema = loadSchema();
loadDOMDocument(fileURL, jaxpSchema);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
addUserDefinedSimpleTypes(schema);
String xpath = "myType:QNameBased(\"value1\") cast as myType:QNameBased";
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.types.QName in project webtools.sourceediting by eclipse.
the class SeqExprCastSITest method test_qname_cast_1.
// Evaluates casting a QName to another QName.
public void test_qname_cast_1() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/SchemaImport/SeqExprCastSI/qname-cast-1.xq";
String resultFile = "/ExpectedTestResults/SchemaImport/SeqExprCastSI/value1.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
Schema jaxpSchema = loadSchema();
loadDOMDocument(fileURL, jaxpSchema);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
addUserDefinedSimpleTypes(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.types.QName in project webtools.sourceediting by eclipse.
the class SeqExprCastSITest method test_qname_cast_2.
// Evaluates casting QName derived type to a QName.
public void test_qname_cast_2() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/SchemaImport/SeqExprCastSI/qname-cast-2.xq";
String resultFile = "/ExpectedTestResults/SchemaImport/SeqExprCastSI/value1.txt";
String expectedResult = getExpectedResult(resultFile);
URL fileURL = bundle.getEntry(inputFile);
Schema jaxpSchema = loadSchema();
loadDOMDocument(fileURL, jaxpSchema);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
addUserDefinedSimpleTypes(schema);
String xpath = "myType:QNameBased(\"value1\")";
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);
}
Aggregations