Search in sources :

Example 16 with AnyType

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

the class SequenceTypeSyntaxTest method test_sequence_type_11.

// Simple evaluation of sequence type matching involving castable as and a sequence of one double. (Uses double?).
public void test_sequence_type_11() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-11.xq";
    String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.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);
        AnyType result = rs.first();
        actual = result.getStringValue();
    } catch (XPathParserException ex) {
        actual = ex.code();
    } catch (StaticError ex) {
        actual = ex.code();
    }
    assertEquals("XPath Result Error:", 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) AnyType(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType) URL(java.net.URL)

Example 17 with AnyType

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

the class SequenceTypeSyntaxTest method test_sequence_type_17.

// Simple evaluation of sequence type matching involving castable as and a sequence of one string. (Uses integer?).
public void test_sequence_type_17() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-17.xq";
    String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.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);
        AnyType result = rs.first();
        actual = result.getStringValue();
    } catch (XPathParserException ex) {
        actual = ex.code();
    } catch (StaticError ex) {
        actual = ex.code();
    }
    assertEquals("XPath Result Error:", 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) AnyType(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType) URL(java.net.URL)

Example 18 with AnyType

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

the class SequenceTypeSyntaxTest method test_sequence_type_10.

// Simple evaluation of sequence type matching involving castable as and a sequence of two integers. (Uses integer?).
public void test_sequence_type_10() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-10.xq";
    String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.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);
        AnyType result = rs.first();
        actual = result.getStringValue();
    } catch (XPathParserException ex) {
        actual = ex.code();
    } catch (StaticError ex) {
        actual = ex.code();
    }
    assertEquals("XPath Result Error:", 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) AnyType(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType) URL(java.net.URL)

Example 19 with AnyType

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

the class SequenceTypeSyntaxTest method test_sequence_type_18.

// Simple evaluation of sequence type matching involving castable as and a sequence of two strings. (Uses integer?).
public void test_sequence_type_18() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-18.xq";
    String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/falsevalue.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);
        AnyType result = rs.first();
        actual = result.getStringValue();
    } catch (XPathParserException ex) {
        actual = ex.code();
    } catch (StaticError ex) {
        actual = ex.code();
    }
    assertEquals("XPath Result Error:", 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) AnyType(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType) URL(java.net.URL)

Example 20 with AnyType

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

the class SequenceTypeSyntaxTest method test_sequence_type_9.

// Simple evaluation of sequence type matching involving castable as and a sequence of one integer. (Uses integer?).
public void test_sequence_type_9() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Basics/Types/SequenceTypeSyntax/sequence-type-9.xq";
    String resultFile = "/ExpectedTestResults/Basics/Types/SequenceTypeSyntax/truevalue.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);
        AnyType result = rs.first();
        actual = result.getStringValue();
    } catch (XPathParserException ex) {
        actual = ex.code();
    } catch (StaticError ex) {
        actual = ex.code();
    }
    assertEquals("XPath Result Error:", 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) AnyType(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType) URL(java.net.URL)

Aggregations

AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)162 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)127 StaticError (org.eclipse.wst.xml.xpath2.processor.StaticError)123 XPathParserException (org.eclipse.wst.xml.xpath2.processor.XPathParserException)123 URL (java.net.URL)122 XSModel (org.apache.xerces.xs.XSModel)121 DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)40 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)38 Iterator (java.util.Iterator)37 Item (org.eclipse.wst.xml.xpath2.api.Item)26 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)14 NodeType (org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType)14 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)11 AnyAtomicType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType)9 XSDouble (org.eclipse.wst.xml.xpath2.processor.internal.types.XSDouble)9 Collection (java.util.Collection)8 XSString (org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)8 ListIterator (java.util.ListIterator)7 ArrayList (java.util.ArrayList)6 NumericType (org.eclipse.wst.xml.xpath2.processor.internal.types.NumericType)6