Search in sources :

Example 41 with QName

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

the class PrefixFromQNameTest method test_fn_prefix_from_qname_19.

// Evaluates the "fn-prefix-from-qname" function as argument to fn:contains function.
public void test_fn_prefix_from_qname_19() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/Operators/CompExpr/ValComp/QNameOp/PrefixFromQName/fn-prefix-from-qname-19.xq";
    String resultFile = "/ExpectedTestResults/Expressions/Operators/CompExpr/ValComp/QNameOp/PrefixFromQName/fn-prefix-from-qname-19.txt";
    String expectedResult = getExpectedResult(resultFile);
    URL fileURL = bundle.getEntry(inputFile);
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    addNamespace("foo", "http://example.org");
    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 42 with QName

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

the class PrefixFromQNameTest method test_fn_prefix_from_qname_3.

// Evaluates the "fn-prefix-from-qname" function as argument to fn:string function and no prefix.
public void test_fn_prefix_from_qname_3() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/Operators/CompExpr/ValComp/QNameOp/PrefixFromQName/fn-prefix-from-qname-3.xq";
    String resultFile = "/ExpectedTestResults/Expressions/Operators/CompExpr/ValComp/QNameOp/PrefixFromQName/fn-prefix-from-qname-3.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 43 with QName

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

the class PrefixFromQNameTest method test_fn_prefix_from_qname_6.

// Evaluates the "fn-prefix-from-qname" function as argument to fn:string function and with prefix.
public void test_fn_prefix_from_qname_6() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/Operators/CompExpr/ValComp/QNameOp/PrefixFromQName/fn-prefix-from-qname-6.xq";
    String resultFile = "/ExpectedTestResults/Expressions/Operators/CompExpr/ValComp/QNameOp/PrefixFromQName/fn-prefix-from-qname-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);
    addNamespace("foo", "http://example.org");
    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 44 with QName

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

the class PrefixFromQNameTest method test_fn_prefix_from_qname_9.

// Evaluates the "fn-prefix-from-qname" function as argument to upper-case function.
public void test_fn_prefix_from_qname_9() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/Operators/CompExpr/ValComp/QNameOp/PrefixFromQName/fn-prefix-from-qname-9.xq";
    String resultFile = "/ExpectedTestResults/Expressions/Operators/CompExpr/ValComp/QNameOp/PrefixFromQName/fn-prefix-from-qname-9.txt";
    String expectedResult = getExpectedResult(resultFile);
    URL fileURL = bundle.getEntry(inputFile);
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    addNamespace("foo", "http://example.org");
    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 45 with QName

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

the class PrefixFromQNameTest method test_fn_prefix_from_qname_14.

// Evaluates the "fn-prefix-from-qname" function as argument to string-length function.
public void test_fn_prefix_from_qname_14() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/Expressions/Operators/CompExpr/ValComp/QNameOp/PrefixFromQName/fn-prefix-from-qname-14.xq";
    String resultFile = "/ExpectedTestResults/Expressions/Operators/CompExpr/ValComp/QNameOp/PrefixFromQName/fn-prefix-from-qname-14.txt";
    String expectedResult = getExpectedResult(resultFile);
    URL fileURL = bundle.getEntry(inputFile);
    loadDOMDocument(fileURL);
    // Get XML Schema Information for the Document
    XSModel schema = getGrammar();
    setupDynamicContext(schema);
    addNamespace("foo", "http://example.org");
    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

DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)77 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)77 URL (java.net.URL)76 XSModel (org.apache.xerces.xs.XSModel)76 StaticError (org.eclipse.wst.xml.xpath2.processor.StaticError)76 XPathParserException (org.eclipse.wst.xml.xpath2.processor.XPathParserException)76 QName (org.eclipse.wst.xml.xpath2.processor.internal.types.QName)42 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)21 Iterator (java.util.Iterator)18 Collection (java.util.Collection)17 ArrayList (java.util.ArrayList)13 VarExprPair (org.eclipse.wst.xml.xpath2.processor.internal.ast.VarExprPair)11 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)10 NodeType (org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType)10 ListIterator (java.util.ListIterator)9 XSString (org.eclipse.wst.xml.xpath2.processor.internal.types.XSString)9 XPathExpr (org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr)6 TypeDefinition (org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition)5 SeqType (org.eclipse.wst.xml.xpath2.processor.internal.SeqType)5 Schema (javax.xml.validation.Schema)4