Search in sources :

Example 21 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_5.

// Evaluation of a range expression that uses the empty sequence.
public void test_rangeExpr_5() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-5.xq";
    String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-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);
        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 22 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_1.

// Simple range expression using positive integers.
public void test_rangeExpr_1() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-1.xq";
    String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-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);
        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 23 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_2.

// Evaluation of a range expression of length one containing the single integer 10.
public void test_rangeExpr_2() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-2.xq";
    String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-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);
}
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 24 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_22.

// Evaluation of a range expression, where the first operand is a subtraction operation.
public void test_rangeExpr_22() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-22.xq";
    String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-22.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 25 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_20.

// Evaluation of a range expression, where the second operand is a multiplication operation.
public void test_rangeExpr_20() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/SeqExpr/RangeExpr/rangeExpr-20.xq";
    String resultFile = "/ExpectedTestResults/Expressions/SeqExpr/RangeExpr/rangeExpr-20.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