Search in sources :

Example 26 with RangeExpr

use of org.eclipse.wst.xml.xpath2.processor.internal.ast.RangeExpr in project webtools.sourceediting by eclipse.

the class RangeExprTest method test_rangeExpr_11.

// Evaluation of a range expression, where both operands are "xs:integer" functions.
public void test_rangeExpr_11() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-11.xq";
    String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-11.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);
}
Also used : XPathParserException(org.eclipse.wst.xml.xpath2.processor.XPathParserException) ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSModel(org.apache.xerces.xs.XSModel) StaticError(org.eclipse.wst.xml.xpath2.processor.StaticError) DynamicError(org.eclipse.wst.xml.xpath2.processor.DynamicError) URL(java.net.URL)

Example 27 with RangeExpr

use of org.eclipse.wst.xml.xpath2.processor.internal.ast.RangeExpr in project webtools.sourceediting by eclipse.

the class RangeExprTest method test_rangeExpr_7.

// Evaluation of a range expression, where the first operand are negative numbers.
public void test_rangeExpr_7() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-7.xq";
    String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-7.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);
}
Also used : XPathParserException(org.eclipse.wst.xml.xpath2.processor.XPathParserException) ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSModel(org.apache.xerces.xs.XSModel) StaticError(org.eclipse.wst.xml.xpath2.processor.StaticError) DynamicError(org.eclipse.wst.xml.xpath2.processor.DynamicError) URL(java.net.URL)

Example 28 with RangeExpr

use of org.eclipse.wst.xml.xpath2.processor.internal.ast.RangeExpr in project webtools.sourceediting by eclipse.

the class RangeExprTest method test_rangeExpr_15.

// Evaluation of a range expression as an argument to the "fn:min" function.
public void test_rangeExpr_15() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-15.xq";
    String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-15.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);
}
Also used : XPathParserException(org.eclipse.wst.xml.xpath2.processor.XPathParserException) ResultSequence(org.eclipse.wst.xml.xpath2.processor.ResultSequence) XSModel(org.apache.xerces.xs.XSModel) StaticError(org.eclipse.wst.xml.xpath2.processor.StaticError) DynamicError(org.eclipse.wst.xml.xpath2.processor.DynamicError) URL(java.net.URL)

Aggregations

URL (java.net.URL)27 XSModel (org.apache.xerces.xs.XSModel)27 DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)27 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)27 StaticError (org.eclipse.wst.xml.xpath2.processor.StaticError)27 XPathParserException (org.eclipse.wst.xml.xpath2.processor.XPathParserException)27 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)1