public interface SearchContext
| Modifier and Type | Method and Description |
|---|---|
XPathResult |
evaluate(java.lang.String expression)
Evaluates an XPath expression for the
使用XPathResultType.ANY_TYPE评估文档元素的XPath表达式并返回结果。 document element with
XPathResultType.ANY_TYPE and returns the result.
|
XPathResult |
evaluate(java.lang.String expression, XPathResultType type)
Returns an
根据XPath表达式和其他给定参数返回XPathResult。 XPathResult based on an XPath
expression and other given parameters.
|
DOMElement |
findElement(By method)
Finds first DOM element in the current document or element with the given
使用给定方法在当前文档或元素中查找第一个DOM元素。 method.
|
java.util.List<DOMElement> |
findElements(By method)
Finds all DOM elements in the current document or element with the given
使用给定的方法查找当前文档或元素中的所有DOM元素。 method.
|
java.util.List<DOMElement> findElements(By method)
method. Returns empty list if there's no DOM elements were found with the given find method.
method - one of the predefined search methods you can obtain via
By class. Cannot be
null.
-您可以通过课程获得的预定义搜索方法之一。不可能是 。
DOMElement findElement(By method)
method. Returns
null if element wasn't found using given find method.
method - one of the predefined search methods you can obtain via
By class. Cannot be
null.
-您可以通过课程获得的预定义搜索方法之一。不可能是 。
null if element wasn't found.
使用给定的find方法找到的第一个元素,或者是否找不到元素。
XPathResult evaluate(java.lang.String expression)
document element with
XPathResultType.ANY_TYPE and returns the result. Equivalent of:
evaluate(expression, getDocumentElement(), XPathResultType.ANY_TYPE);
expression - a string representing the XPath to be evaluated. Cannot be
null or empty string.
-表示要评估的XPath的字符串。不能为或为空字符串。
XPathResult object of the type specified in the
type parameter. The return value will be always a valid
XPathResult object. In case of incorrect expression, the result object will contain information about evaluation error. See the
XPathResult.isError() and
XPathResult.getErrorMessage() methods.
参数中指定类型的对象。返回值将始终是有效对象。如果表达式不正确,结果对象将包含有关评估错误的信息。请参见和方法。
java.lang.IllegalArgumentException - when
expression is
null or empty string.
java.lang.IllegalStateException - when the document element is not available in the current document.
XPathResult evaluate(java.lang.String expression, XPathResultType type)
XPathResult based on an XPath
expression and other given parameters.
expression - a string representing the XPath to be evaluated. Cannot be
null or empty string.
-表示要评估的XPath的字符串。不能为或为空字符串。
type - type of result XPathResult to return. See
XPathResultType. Cannot be
null.
-要返回的结果XPathResult的类型。请参阅。不可能是 。
XPathResult object of the type specified in the
type parameter. The return value will be always a valid
XPathResult object. In case of incorrect expression, the result object will contain information about evaluation error. See the
XPathResult.isError() and
XPathResult.getErrorMessage() methods.
参数中指定类型的对象。返回值将始终是有效对象。如果表达式不正确,结果对象将包含有关评估错误的信息。请参见和方法。
java.lang.IllegalArgumentException - when
expression is
null or empty string; when
contextNode is
null; when
type is
null.