Package org.apache.poi.ooxml.util
Class XPathHelper
- java.lang.Object
-
- org.apache.poi.ooxml.util.XPathHelper
-
public final class XPathHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static XPathFactorygetFactory()static <T extends XmlObject>
TselectProperty(XmlObject startObject, Class<T> resultClass, XSLFShape.ReparseFactory<T> factory, QName[]... path)Internal code - API may change any time!
-
-
-
Method Detail
-
getFactory
public static XPathFactory getFactory()
-
selectProperty
@Internal public static <T extends XmlObject> T selectProperty(XmlObject startObject, Class<T> resultClass, XSLFShape.ReparseFactory<T> factory, QName[]... path) throws XmlException
Internal code - API may change any time!The XSLFShape.selectProperty(Class, String) xquery method has some performance penalties, which can be workaround by using
XmlCursor. This method also takes into account thatAlternateContenttags can occur anywhere on the given path.It returns the first element found - the search order is:
- searching for a direct child
- searching for a AlternateContent.Choice child
- searching for a AlternateContent.Fallback child
- Parameters:
resultClass- the requested result classfactory- 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 streampath- the elements path, each array must contain at least 1 QName, but can contain additional alternative tags- Returns:
- the xml object at the path location, or null if not found
- Throws:
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.- Since:
- POI 4.1.2
-
-