/** * Compile an XPath string expression for efficient evaluation later. * @param xpathExpression the XPath expression as a string * @return the compiled XPath expression */ public XPathExpression compileXPath(String xpathExpression) throws XPathExpressionException { return getXPathProcessor().compile(xpathExpression); } /**
/** * Compile an XPath string expression for efficient evaluation later. * @param xpathExpression the XPath expression as a string * @return the compiled XPath expression * @throws XPathExpressionException if xpathExpression cannot be compiled */ public XPathExpression compileXPath(String xpathExpression) throws XPathExpressionException { return getXPathProcessor().compile(xpathExpression); } /**
/** * Evaluate a string XPath expression relative to a node such as a node * returned by a previous XPath expression. * An XPath expression can return a Node or subinterface such as * Element or Text, a NodeList, or a Boolean, Number, or String value. * @param xpathExpression the XPath expression as a string * @param context the node for evaluating the expression * @param as the type of the value * @return the value produced by the XPath expression */ public <T> T evaluateXPath(String xpathExpression, Node context, Class<T> as) throws XPathExpressionException { checkContext(context); return castAs( getXPathProcessor().evaluate(xpathExpression, context, returnXPathConstant(as)), as ); } /**
/** * Evaluate a string XPath expression relative to a node such as a node * returned by a previous XPath expression. * An XPath expression can return a Node or subinterface such as * Element or Text, a NodeList, or a Boolean, Number, or String value. * @param xpathExpression the XPath expression as a string * @param context the node for evaluating the expression * @param as the type expected to be matched by the xpath * @param <T> the type to return * @return the value produced by the XPath expression * @throws XPathExpressionException if xpathExpression cannot be evaluated */ public <T> T evaluateXPath(String xpathExpression, Node context, Class<T> as) throws XPathExpressionException { checkContext(context); return castAs( getXPathProcessor().evaluate(xpathExpression, context, returnXPathConstant(as)), as ); } /**
private DOMHandle initNamespaces(DOMHandle handle) { EditableNamespaceContext namespaces = new EditableNamespaceContext(); namespaces.setNamespaceURI("table", "http://marklogic.com/table"); handle.getXPathProcessor().setNamespaceContext(namespaces); return handle; } private void checkSingleRow(NodeList row, RowSetPart datatypeStyle) {
responseHandle.getXPathProcessor().setNamespaceContext(namespaces);