本文整理汇总了Java中org.w3c.dom.xpath.XPathEvaluator类的典型用法代码示例。如果您正苦于以下问题:Java XPathEvaluator类的具体用法?Java XPathEvaluator怎么用?Java XPathEvaluator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XPathEvaluator类属于org.w3c.dom.xpath包,在下文中一共展示了XPathEvaluator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getXPathEvaluator
import org.w3c.dom.xpath.XPathEvaluator; //导入依赖的package包/类
XPathEvaluator getXPathEvaluator(Document doc)
throws XMLStreamException
{
DOMImplementation dom = doc.getImplementation();
if (!dom.hasFeature("XPath", "3.0"))
throw new XMLStreamException("XPath not supported");
return (XPathEvaluator) doc;
}
示例2: createEvaluator
import org.w3c.dom.xpath.XPathEvaluator; //导入依赖的package包/类
public static final native XPathEvaluator createEvaluator() /*-{
return new XPathEvaluator();
}-*/;
示例3: fromDocument
import org.w3c.dom.xpath.XPathEvaluator; //导入依赖的package包/类
public static final native XPathEvaluator fromDocument(Document doc) /*-{
return doc;
}-*/;
示例4: test5
import org.w3c.dom.xpath.XPathEvaluator; //导入依赖的package包/类
public void test5() {
XPathEvaluator eval = XPathUtils.createEvaluator();
ASSERT.that(eval).isNotNull();
}
示例5: compileXQExpr
import org.w3c.dom.xpath.XPathEvaluator; //导入依赖的package包/类
/**
* Take the received string, which is an XML query expression,
* compile it, and store the compiled query locally. Note
* that for now, we only support XPath because that's what
* Xalan supports.
*
* @param queryExpr The XPath expression to compile
*/
public void compileXQExpr(String queryExpr, String opName)
throws StandardException
{
try {
/* The following XPath constructor compiles the expression
* as part of the construction process. We pass a null
* namespace resolver object so that the implementation will
* provide one for us, which means prefixes will not be resolved
* in the query (Xalan will just throw an error if a prefix
* is used). In the future we may want to revisit this
* to make it easier for users to query based on namespaces.
*/
XPathEvaluator eval = (XPathEvaluator)
dBuilder.getDOMImplementation().getFeature("+XPath", "3.0");
query = eval.createExpression(queryExpr, null);
this.queryExpr = queryExpr;
this.opName = opName;
this.recompileQuery = false;
} catch (Throwable te) {
/* Something went wrong during compilation of the
* expression; wrap the error and re-throw it.
* Note: we catch "Throwable" here to catch as many
* Xalan-produced errors as possible in order to
* minimize the chance of an uncaught Xalan error
* (such as a NullPointerException) causing Derby
* to fail in a more serious way. In particular, an
* uncaught Java exception like NPE can result in
* Derby throwing "ERROR 40XT0: An internal error was
* identified by RawStore module" for all statements on
* the connection after the failure--which we clearly
* don't want. If we catch the error and wrap it,
* though, the statement will fail but Derby will
* continue to run as normal.
*/
throw StandardException.newException(
SQLState.LANG_XML_QUERY_ERROR, te, opName, te.getMessage());
}
}