Search in sources :

Example 1 with XPathParserException

use of org.eclipse.wst.xml.xpath2.processor.XPathParserException in project webtools.sourceediting by eclipse.

the class SeqExprCastableTest method test_CastableAs080.

// Try xs:untypedAtomic(http://www.example.com/~b%C3%A9b%C3%A9) castable as xs:anyURI.
public void test_CastableAs080() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/exprSeqTypes/SeqExprCastable/CastableAs080.xq";
    String resultFile = "/ExpectedTestResults/Expressions/exprSeqTypes/SeqExprCastable/CastableAs080.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 2 with XPathParserException

use of org.eclipse.wst.xml.xpath2.processor.XPathParserException in project webtools.sourceediting by eclipse.

the class SeqExprCastableTest method test_CastableAs342.

// Try xs:dayTimeDuration(P3DT10H30M) castable as xs:date.
public void test_CastableAs342() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/exprSeqTypes/SeqExprCastable/CastableAs342.xq";
    String resultFile = "/ExpectedTestResults/Expressions/exprSeqTypes/SeqExprCastable/CastableAs342.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 3 with XPathParserException

use of org.eclipse.wst.xml.xpath2.processor.XPathParserException in project webtools.sourceediting by eclipse.

the class SeqExprCastableTest method test_CastableAs104.

// Try xs:string(-0.0E0) castable as xs:integer.
public void test_CastableAs104() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/exprSeqTypes/SeqExprCastable/CastableAs104.xq";
    String resultFile = "/ExpectedTestResults/Expressions/exprSeqTypes/SeqExprCastable/CastableAs104.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 4 with XPathParserException

use of org.eclipse.wst.xml.xpath2.processor.XPathParserException in project webtools.sourceediting by eclipse.

the class SeqExprCastableTest method test_CastableAs156.

// Try xs:string(00000000) castable as xs:base64Binary.
public void test_CastableAs156() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/exprSeqTypes/SeqExprCastable/CastableAs156.xq";
    String resultFile = "/ExpectedTestResults/Expressions/exprSeqTypes/SeqExprCastable/CastableAs156.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 5 with XPathParserException

use of org.eclipse.wst.xml.xpath2.processor.XPathParserException in project webtools.sourceediting by eclipse.

the class SeqExprCastableTest method test_CastableAs034.

// Try xs:untypedAtomic(-P1Y1M1DT1H1M1.123S) castable as xs:dayTimeDuration.
public void test_CastableAs034() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/exprSeqTypes/SeqExprCastable/CastableAs034.xq";
    String resultFile = "/ExpectedTestResults/Expressions/exprSeqTypes/SeqExprCastable/CastableAs034.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

XPathParserException (org.eclipse.wst.xml.xpath2.processor.XPathParserException)8283 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)8281 StaticError (org.eclipse.wst.xml.xpath2.processor.StaticError)8280 URL (java.net.URL)8278 XSModel (org.apache.xerces.xs.XSModel)8276 DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)8193 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)122 Schema (javax.xml.validation.Schema)100 XPath (org.eclipse.wst.xml.xpath2.processor.ast.XPath)77 DefaultEvaluator (org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator)72 Evaluator (org.eclipse.wst.xml.xpath2.processor.Evaluator)72 DynamicContext (org.eclipse.wst.xml.xpath2.processor.DynamicContext)71 XSAnyURI (org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI)16 JFlexCupParser (org.eclipse.wst.xml.xpath2.processor.JFlexCupParser)6 XPathParser (org.eclipse.wst.xml.xpath2.processor.XPathParser)6 StaticChecker (org.eclipse.wst.xml.xpath2.processor.StaticChecker)4 StaticNameResolver (org.eclipse.wst.xml.xpath2.processor.StaticNameResolver)4 List (java.util.List)2 StringReader (java.io.StringReader)1 Iterator (java.util.Iterator)1