public final class XPathHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static javax.xml.xpath.XPathFactory |
getFactory() |
static <T extends org.apache.xmlbeans.XmlObject> |
selectProperty(org.apache.xmlbeans.XmlObject startObject, java.lang.Class<T> resultClass, XSLFShape.ReparseFactory<T> factory, javax.xml.namespace.QName[]... path)
Internal code - API may change any time!
(内部代码 - API 可能随时更改!)
|
public static javax.xml.xpath.XPathFactory getFactory()
@Internal public static <T extends org.apache.xmlbeans.XmlObject> T selectProperty(org.apache.xmlbeans.XmlObject startObject, java.lang.Class<T> resultClass, XSLFShape.ReparseFactory<T> factory, javax.xml.namespace.QName[]... path) throws org.apache.xmlbeans.XmlException
The #selectProperty(Class, String)
xquery method has some performance penalties, which can be workaround by using XmlCursor
. This method also takes into account that AlternateContent
tags can occur anywhere on the given path.
It returns the first element found - the search order is:
resultClass
- the requested result class
(resultClass - 请求的结果类)
factory
- a factory parse method reference to allow reparsing of elements extracted from AlternateContent elements. Usually the enclosing XmlBeans type needs to be used to parse the stream
(factory - 工厂解析方法引用,允许重新解析从 AlternateContent 元素中提取的元素。通常需要使用封闭的 XmlBeans 类型来解析流)
path
- the elements path, each array must contain at least 1 QName, but can contain additional alternative tags
(path - 元素路径,每个数组必须至少包含 1 个 QName,但可以包含其他替代标签)
org.apache.xmlbeans.XmlException
- If factory is null, a XmlException is thrown if the AlternateContent is not allowed by the surrounding element or if the extracted object is of the generic type XmlAnyTypeImpl.
(org.apache.xmlbeans.XmlException - 如果 factory 为 null,如果周围元素不允许 AlternateContent 或提取的对象是通用类型 XmlAnyTypeImpl,则引发 XmlException。)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.