Search in sources :

Example 1 with Axis

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

the class STAxesTest method test_ST_Axes001.

// self:: axis with explicit name test called on set of nodes which do not contain any nodes of this name.
public void test_ST_Axes001() throws Exception {
    String inputFile = "/TestSources/TreeCompass.xml";
    String xqFile = "/Queries/XQuery/StaticTyping/STPathExpr/STSteps/STAxes/ST-Axes001.xq";
    String expectedResult = "XPST0005";
    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 Axis

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

the class STAxesTest method test_statictypingaxis_4.

// Evaluates static typing on parent axis. Context item not a node.
public void test_statictypingaxis_4() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/StaticTyping/STPathExpr/STSteps/STAxes/statictypingaxis-4.xq";
    String expectedResult = "XPTY0019";
    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 Axis

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

the class STAxesTest method test_statictypingaxis_5.

// Evaluates static typing on descendant axis. Context item not a node.
public void test_statictypingaxis_5() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/StaticTyping/STPathExpr/STSteps/STAxes/statictypingaxis-5.xq";
    String expectedResult = "XPTY0019";
    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 Axis

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

the class STAxesTest method test_statictypingaxis_1.

// Evaluates static typing on child axis. Context item not a node.
public void test_statictypingaxis_1() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/StaticTyping/STPathExpr/STSteps/STAxes/statictypingaxis-1.xq";
    String expectedResult = "XPTY0019";
    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 Axis

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

the class STAxesTest method test_statictypingaxis_2.

// Evaluates static typing on self axis. Context item not a node.
public void test_statictypingaxis_2() throws Exception {
    String inputFile = "/TestSources/emptydoc.xml";
    String xqFile = "/Queries/XQuery/StaticTyping/STPathExpr/STSteps/STAxes/statictypingaxis-2.xq";
    String expectedResult = "XPTY0019";
    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

StaticError (org.eclipse.wst.xml.xpath2.processor.StaticError)9 URL (java.net.URL)8 XSModel (org.apache.xerces.xs.XSModel)8 DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)8 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)8 XPathParserException (org.eclipse.wst.xml.xpath2.processor.XPathParserException)8 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)4 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)4 NodeType (org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType)4 ForwardAxis (org.eclipse.wst.xml.xpath2.processor.internal.ForwardAxis)3 ParentAxis (org.eclipse.wst.xml.xpath2.processor.internal.ParentAxis)3 ReverseAxis (org.eclipse.wst.xml.xpath2.processor.internal.ReverseAxis)3 Iterator (java.util.Iterator)2 ListIterator (java.util.ListIterator)2 Axis (org.eclipse.wst.xml.xpath2.processor.internal.Axis)2 DescendantOrSelfAxis (org.eclipse.wst.xml.xpath2.processor.internal.DescendantOrSelfAxis)2 SelfAxis (org.eclipse.wst.xml.xpath2.processor.internal.SelfAxis)2 VarExprPair (org.eclipse.wst.xml.xpath2.processor.internal.ast.VarExprPair)2 AnyType (org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType)2 ArrayList (java.util.ArrayList)1