public final class UtilXml extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static List<Element> |
childElementList(Element element) |
static List<Element> |
childElementList(Element element,
String childElementName)
获取某元素下的直接子节点
|
static Element |
childElementOne(Element element,
String childElementName)
获取第一个匹配的元素
|
static List<Node> |
childNodeList(Element element)
获取某元素下的直接子节点
|
static boolean |
hasChildElement(Element element)
判断元素是否包含子元素
|
static Document |
readXmlDocument(InputStream is,
boolean validate,
String docDescription) |
static Document |
readXmlDocument(String content) |
static Document |
readXmlDocument(String content,
boolean validate) |
static Document |
readXmlDocument(URL url) |
static Document |
readXmlDocument(URL url,
boolean validate) |
static List<Element> |
xpathElementList(Element element,
String xpath)
xpath 获取元素
|
static Element |
xpathElementOne(Element element,
String xpath)
xpath 获取元素
|
static List<Node> |
xpathNodeList(Element element,
String xpath)
xpath 获取node
|
static Node |
xpathNodeOne(Element element,
String xpath)
xpath 获取元素
|
public static Document readXmlDocument(String content) throws SAXException, ParserConfigurationException, IOException
public static Document readXmlDocument(String content, boolean validate) throws SAXException, ParserConfigurationException, IOException
public static Document readXmlDocument(URL url) throws SAXException, ParserConfigurationException, IOException
public static Document readXmlDocument(URL url, boolean validate) throws SAXException, ParserConfigurationException, IOException
public static Document readXmlDocument(InputStream is, boolean validate, String docDescription) throws ParserConfigurationException, SAXException, IOException
public static List<Element> childElementList(Element element, String childElementName)
element - 节点childElementName - 子节点名称public static Element childElementOne(Element element, String childElementName)
element - ElementchildElementName - 节点名称public static List<Node> childNodeList(Element element)
element - 节点public static boolean hasChildElement(Element element)
element - 节点public static Element xpathElementOne(Element element, String xpath) throws Exception
element - 节点xpath - xpath 表达Exception - 包含多个节点public static List<Element> xpathElementList(Element element, String xpath) throws Exception
element - 节点xpath - xpath表达式Exception - xpath解析错误public static Node xpathNodeOne(Element element, String xpath) throws Exception
element - 节点xpath - xpath表达式Exception - 节点不唯一Copyright © 2019. All rights reserved.