use of org.eclipse.wst.xml.xpath2.processor.internal.Axis in project webtools.sourceediting by eclipse.
the class AncestorAxis method iterate.
/**
* Get the ancestors of the context node.
*
* @param node
* is the type of node.
*/
// XXX unify this with descendants axis ?
public void iterate(NodeType node, ResultBuffer copyInto, Node limitNode) {
if (limitNode != null && limitNode.isSameNode(node.node_value()))
return;
int before = copyInto.size();
// get the parent
super.iterate(node, copyInto, limitNode);
// no parent
if (copyInto.size() == before)
return;
NodeType parent = (NodeType) copyInto.item(before);
// get ancestors of parent
iterate(parent, copyInto, limitNode);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.Axis in project webtools.sourceediting by eclipse.
the class AxesTest method test_axis_err_1.
// Evaluation of a step axis, which operates on a non node context item.
public void test_axis_err_1() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/Expressions/PathExpr/Steps/Axes/axis-err-1.xq";
String expectedResult = "XPTY0020";
URL fileURL = bundle.getEntry(inputFile);
loadDOMDocument(fileURL);
// Get XML Schema Information for the Document
XSModel schema = getGrammar();
setupDynamicContext(schema);
String xpath = extractXPathExpression(xqFile, inputFile);
xpath = "20[child::text()]";
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);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.Axis in project webtools.sourceediting by eclipse.
the class TestBugs method testNamespaceAxis.
public void testNamespaceAxis() {
setupDynamicContext(null);
String xpath = "count(namespace::*)";
try {
compileXPath(xpath);
fail("This should have failed since we don't support the namespace axis");
} catch (StaticError se) {
assertEquals("XPST0010", se.code());
}
}
use of org.eclipse.wst.xml.xpath2.processor.internal.Axis in project webtools.sourceediting by eclipse.
the class STAxesTest method test_statictypingaxis_6.
// Evaluates static typing on descendant-or-self axis. Context item not a node.
public void test_statictypingaxis_6() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/StaticTyping/STPathExpr/STSteps/STAxes/statictypingaxis-6.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);
}
use of org.eclipse.wst.xml.xpath2.processor.internal.Axis in project webtools.sourceediting by eclipse.
the class STAxesTest method test_statictypingaxis_3.
// Evaluates static typing on attribute axis. Context item not a node.
public void test_statictypingaxis_3() throws Exception {
String inputFile = "/TestSources/emptydoc.xml";
String xqFile = "/Queries/XQuery/StaticTyping/STPathExpr/STSteps/STAxes/statictypingaxis-3.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);
}
Aggregations