Search in sources :

Example 61 with Function

use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.

the class SeqZeroOrOneFuncTest method test_fn_zero_or_onenni1args_2.

// Evaluates the "zero-or-one" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range).
public void test_fn_zero_or_onenni1args_2() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-onenni1args-2.xq";
    String resultFile = "/ExpectedTestResults/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-onenni1args-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 62 with Function

use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.

the class SeqZeroOrOneFuncTest method test_fn_zero_or_onedec1args_2.

// Evaluates the "zero-or-one" function with the arguments set as follows: $arg = xs:decimal(mid range).
public void test_fn_zero_or_onedec1args_2() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-onedec1args-2.xq";
    String resultFile = "/ExpectedTestResults/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-onedec1args-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 63 with Function

use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.

the class SeqZeroOrOneFuncTest method test_fn_zero_or_oneusht1args_1.

// Evaluates the "zero-or-one" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound).
public void test_fn_zero_or_oneusht1args_1() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-oneusht1args-1.xq";
    String resultFile = "/ExpectedTestResults/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-oneusht1args-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 64 with Function

use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.

the class SeqZeroOrOneFuncTest method test_fn_zero_or_one_1.

// Evaluates the "zero-or-one" function the argument is a sequence of two items.
public void test_fn_zero_or_one_1() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-one-1.xq";
    String expectedResult = "FORG0003";
    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 65 with Function

use of org.eclipse.wst.xml.xpath2.api.Function in project webtools.sourceediting by eclipse.

the class SeqZeroOrOneFuncTest method test_fn_zero_or_oneflt1args_1.

// Evaluates the "zero-or-one" function with the arguments set as follows: $arg = xs:float(lower bound).
public void test_fn_zero_or_oneflt1args_1() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-oneflt1args-1.xq";
    String resultFile = "/ExpectedTestResults/Functions/SeqFunc/CardinalitySeqFunc/SeqZeroOrOneFunc/fn-zero-or-oneflt1args-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)

Aggregations

URL (java.net.URL)3073 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)3073 XSModel (org.apache.xerces.xs.XSModel)3072 DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)3072 StaticError (org.eclipse.wst.xml.xpath2.processor.StaticError)3072 XPathParserException (org.eclipse.wst.xml.xpath2.processor.XPathParserException)3072 Schema (javax.xml.validation.Schema)19 XSAnyURI (org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI)15 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)14 Item (org.eclipse.wst.xml.xpath2.api.Item)13 BigInteger (java.math.BigInteger)12 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)10 Collection (java.util.Collection)8 Iterator (java.util.Iterator)8 ArrayList (java.util.ArrayList)6 Function (org.eclipse.wst.xml.xpath2.api.Function)6 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)4 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)4 Map (java.util.Map)3 Duration (javax.xml.datatype.Duration)3