public class XPathHelper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
XPathHelper.Builder |
static interface |
XPathHelper.INodeValueParser
自定义节点值解析器
|
| Modifier and Type | Field and Description |
|---|---|
static EntityResolver |
IGNORE_DTD_ENTITY_RESOLVER
用于忽略所有DTD检测
|
| Constructor and Description |
|---|
XPathHelper(DocumentBuilderFactory documentBuilderFactory,
XPathFactory xPathFactory,
InputSource inputSource,
EntityResolver entityResolver,
ErrorHandler errorHandler) |
XPathHelper(DocumentBuilderFactory documentBuilderFactory,
XPathFactory xPathFactory,
String content) |
XPathHelper(DocumentBuilderFactory documentBuilderFactory,
XPathFactory xPathFactory,
String content,
EntityResolver entityResolver) |
XPathHelper(DocumentBuilderFactory documentBuilderFactory,
XPathFactory xPathFactory,
String content,
EntityResolver entityResolver,
ErrorHandler errorHandler) |
XPathHelper(DocumentBuilderFactory documentBuilderFactory,
XPathFactory xPathFactory,
String content,
ErrorHandler errorHandler) |
XPathHelper(DocumentBuilder documentBuilder,
XPath xPath,
InputSource inputSource) |
XPathHelper(InputSource inputSource) |
XPathHelper(InputSource inputSource,
EntityResolver entityResolver) |
XPathHelper(InputSource inputSource,
ErrorHandler errorHandler) |
XPathHelper(XPathFactory xPathFactory,
Document document) |
| Modifier and Type | Method and Description |
|---|---|
static XPathHelper |
create(XPathFactory xPathFactory,
Document document) |
Boolean |
getBooleanValue(Object item,
String expression) |
Boolean |
getBooleanValue(String expression) |
Document |
getDocument() |
Node |
getNode(Object item,
String expression) |
Node |
getNode(String expression) |
NodeList |
getNodeList(Object item,
String expression) |
NodeList |
getNodeList(String expression) |
Number |
getNumberValue(Object item,
String expression) |
Number |
getNumberValue(String expression) |
String |
getStringValue(Object item,
String expression) |
String |
getStringValue(String expression) |
static DocumentBuilderFactory |
newDocumentBuilderFactory() |
static XPathFactory |
newXPathFactory() |
Map<String,Object> |
toMap() |
Map<String,Object> |
toMap(Node parent) |
<T> T |
toObject(Class<T> targetObject) |
<T> T |
toObject(T targetObject) |
public static final EntityResolver IGNORE_DTD_ENTITY_RESOLVER
public XPathHelper(XPathFactory xPathFactory, Document document)
public XPathHelper(DocumentBuilder documentBuilder, XPath xPath, InputSource inputSource) throws IOException, SAXException
IOExceptionSAXExceptionpublic XPathHelper(InputSource inputSource) throws ParserConfigurationException, SAXException, IOException
public XPathHelper(InputSource inputSource, EntityResolver entityResolver) throws ParserConfigurationException, SAXException, IOException
public XPathHelper(InputSource inputSource, ErrorHandler errorHandler) throws ParserConfigurationException, SAXException, IOException
public XPathHelper(DocumentBuilderFactory documentBuilderFactory, XPathFactory xPathFactory, InputSource inputSource, EntityResolver entityResolver, ErrorHandler errorHandler) throws IOException, SAXException, ParserConfigurationException
public XPathHelper(DocumentBuilderFactory documentBuilderFactory, XPathFactory xPathFactory, String content) throws ParserConfigurationException, IOException, SAXException
public XPathHelper(DocumentBuilderFactory documentBuilderFactory, XPathFactory xPathFactory, String content, EntityResolver entityResolver) throws ParserConfigurationException, SAXException, IOException
public XPathHelper(DocumentBuilderFactory documentBuilderFactory, XPathFactory xPathFactory, String content, ErrorHandler errorHandler) throws ParserConfigurationException, SAXException, IOException
public XPathHelper(DocumentBuilderFactory documentBuilderFactory, XPathFactory xPathFactory, String content, EntityResolver entityResolver, ErrorHandler errorHandler) throws IOException, SAXException, ParserConfigurationException
public static DocumentBuilderFactory newDocumentBuilderFactory()
public static XPathFactory newXPathFactory()
public static XPathHelper create(XPathFactory xPathFactory, Document document)
public Document getDocument()
public String getStringValue(String expression) throws XPathExpressionException
XPathExpressionExceptionpublic Number getNumberValue(String expression) throws XPathExpressionException
XPathExpressionExceptionpublic Boolean getBooleanValue(String expression) throws XPathExpressionException
XPathExpressionExceptionpublic Node getNode(String expression) throws XPathExpressionException
XPathExpressionExceptionpublic NodeList getNodeList(String expression) throws XPathExpressionException
XPathExpressionExceptionpublic String getStringValue(Object item, String expression) throws XPathExpressionException
XPathExpressionExceptionpublic Number getNumberValue(Object item, String expression) throws XPathExpressionException
XPathExpressionExceptionpublic Boolean getBooleanValue(Object item, String expression) throws XPathExpressionException
XPathExpressionExceptionpublic Node getNode(Object item, String expression) throws XPathExpressionException
XPathExpressionExceptionpublic NodeList getNodeList(Object item, String expression) throws XPathExpressionException
XPathExpressionExceptionpublic <T> T toObject(Class<T> targetObject)
public <T> T toObject(T targetObject)
Copyright © 2022. All rights reserved.