Search in sources :

Example 6 with XSAnyURI

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI in project webtools.sourceediting by eclipse.

the class SeqDocFuncTest method test_fn_doc_6.

// Evaluation of fn:doc (two different resources) with "is" operator.
public void test_fn_doc_6() throws Exception {
    String inputFile = "/TestSources/works.xml";
    String inputFile2 = "/TestSources/works-mod.xml";
    String xqFile = "/Queries/XQuery/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-6.xq";
    String resultFile = "/ExpectedTestResults/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-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);
    setVariable("input-context1", new XSAnyURI(inputFile));
    setVariable("input-context2", new XSAnyURI(inputFile2));
    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) XSAnyURI(org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI) 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 7 with XSAnyURI

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI in project webtools.sourceediting by eclipse.

the class SeqDocFuncTest method test_fn_doc_22.

// Evaluation of fn:doc used together with "is" operator and a the fn:false() function and the "or" operator.
public void test_fn_doc_22() throws Exception {
    String inputFile = "/TestSources/works-mod.xml";
    String xqFile = "/Queries/XQuery/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-22.xq";
    String resultFile = "/ExpectedTestResults/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-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);
    setVariable("input-context", new XSAnyURI(inputFile));
    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) XSAnyURI(org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI) 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 8 with XSAnyURI

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI in project webtools.sourceediting by eclipse.

the class SeqDocFuncTest method test_fn_doc_15.

// Evaluation of fn:doc as an argument to the fn:nilled function.
public void test_fn_doc_15() throws Exception {
    String inputFile = "/TestSources/works-mod.xml";
    String xqFile = "/Queries/XQuery/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-15.xq";
    String resultFile = "/ExpectedTestResults/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-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);
    setVariable("input-context", new XSAnyURI(inputFile));
    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) XSAnyURI(org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI) 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 9 with XSAnyURI

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI in project webtools.sourceediting by eclipse.

the class SeqDocFuncTest method test_fn_doc_21.

// Evaluation of fn:doc used together with "is" operator and a the fn:true() function and the "or" operator.
public void test_fn_doc_21() throws Exception {
    String inputFile = "/TestSources/works-mod.xml";
    String xqFile = "/Queries/XQuery/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-21.xq";
    String resultFile = "/ExpectedTestResults/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-21.txt";
    String expectedResult = getExpectedResult(resultFile);
    URL fileURL = bundle.getEntry(inputFile);
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    setVariable("input-context", new XSAnyURI(inputFile));
    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) XSAnyURI(org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI) 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 10 with XSAnyURI

use of org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI in project webtools.sourceediting by eclipse.

the class SeqDocFuncTest method test_fn_doc_16.

// Evaluation of fn:doc as an argument to the fn:node-name function.
public void test_fn_doc_16() throws Exception {
    String inputFile = "/TestSources/works-mod.xml";
    String xqFile = "/Queries/XQuery/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-16.xq";
    String resultFile = "/ExpectedTestResults/Functions/NodeSeqFunc/SeqDocFunc/fn-doc-16.txt";
    String expectedResult = getExpectedResult(resultFile);
    URL fileURL = bundle.getEntry(inputFile);
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    setVariable("input-context", new XSAnyURI(inputFile));
    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) XSAnyURI(org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI) 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

XSAnyURI (org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI)22 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)17 URL (java.net.URL)16 XSModel (org.apache.xerces.xs.XSModel)16 DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)16 StaticError (org.eclipse.wst.xml.xpath2.processor.StaticError)16 XPathParserException (org.eclipse.wst.xml.xpath2.processor.XPathParserException)16 Collection (java.util.Collection)4 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)4 Item (org.eclipse.wst.xml.xpath2.api.Item)3 NodeType (org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType)3 Iterator (java.util.Iterator)2 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)2 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)2 AnyAtomicType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType)1 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)1 DocType (org.eclipse.wst.xml.xpath2.processor.internal.types.DocType)1 NumericType (org.eclipse.wst.xml.xpath2.processor.internal.types.NumericType)1 XSDouble (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDouble)1 XSString (org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)1