Search in sources :

Example 1 with SelfAxis

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

the class DefaultEvaluator method root_self_node.

private ResultSequence root_self_node() {
    Axis axis = new SelfAxis();
    ResultBuffer buffer = new ResultBuffer();
    // XXX the cast!!!
    axis.iterate((NodeType) focus().context_item(), buffer, _dc.getLimitNode());
    ResultSequence rs = kind_test(buffer.getSequence(), NodeType.class);
    List records = new ArrayList();
    records.add(rs);
    rs = FnRoot.fn_root(records, _ec);
    return rs;
}
Also used : SelfAxis(org.eclipse.wst.xml.xpath2.processor.internal.SelfAxis) DescendantOrSelfAxis(org.eclipse.wst.xml.xpath2.processor.internal.DescendantOrSelfAxis) ResultBuffer(org.eclipse.wst.xml.xpath2.api.ResultBuffer) ResultSequence(org.eclipse.wst.xml.xpath2.api.ResultSequence) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) NodeList(org.w3c.dom.NodeList) ParentAxis(org.eclipse.wst.xml.xpath2.processor.internal.ParentAxis) SelfAxis(org.eclipse.wst.xml.xpath2.processor.internal.SelfAxis) ReverseAxis(org.eclipse.wst.xml.xpath2.processor.internal.ReverseAxis) DescendantOrSelfAxis(org.eclipse.wst.xml.xpath2.processor.internal.DescendantOrSelfAxis) ForwardAxis(org.eclipse.wst.xml.xpath2.processor.internal.ForwardAxis) Axis(org.eclipse.wst.xml.xpath2.processor.internal.Axis)

Example 2 with SelfAxis

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

the class ancestorOrSelfAxisTest method test_unabbreviatedSyntax_11.

// Evaluates unabbreviated syntax - ancestor-or-self::employee - Selects all the "employee" ancestors of the context node (selects employee, if the context node is "employee").
public void test_unabbreviatedSyntax_11() throws Exception {
    String inputFile = "/TestSources/works-mod.xml";
    String xqFile = "/Queries/XQuery/FullAxis/ancestor-or-selfAxis/unabbreviatedSyntax-11.xq";
    String resultFile = "/ExpectedTestResults/FullAxis/ancestor-or-selfAxis/unabbreviatedSyntax-11.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 = buildXMLResultString(rs);
    } catch (XPathParserException ex) {
        actual = ex.code();
    } catch (StaticError ex) {
        actual = ex.code();
    } catch (DynamicError ex) {
        actual = ex.code();
    }
    assertXMLEqual("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

URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 XSModel (org.apache.xerces.xs.XSModel)1 ResultBuffer (org.eclipse.wst.xml.xpath2.api.ResultBuffer)1 ResultSequence (org.eclipse.wst.xml.xpath2.api.ResultSequence)1 DynamicError (org.eclipse.wst.xml.xpath2.processor.DynamicError)1 ResultSequence (org.eclipse.wst.xml.xpath2.processor.ResultSequence)1 StaticError (org.eclipse.wst.xml.xpath2.processor.StaticError)1 XPathParserException (org.eclipse.wst.xml.xpath2.processor.XPathParserException)1 Axis (org.eclipse.wst.xml.xpath2.processor.internal.Axis)1 DescendantOrSelfAxis (org.eclipse.wst.xml.xpath2.processor.internal.DescendantOrSelfAxis)1 ForwardAxis (org.eclipse.wst.xml.xpath2.processor.internal.ForwardAxis)1 ParentAxis (org.eclipse.wst.xml.xpath2.processor.internal.ParentAxis)1 ReverseAxis (org.eclipse.wst.xml.xpath2.processor.internal.ReverseAxis)1 SelfAxis (org.eclipse.wst.xml.xpath2.processor.internal.SelfAxis)1 NodeList (org.w3c.dom.NodeList)1