public abstract class XmlUtil extends Object
| 构造器和说明 |
|---|
XmlUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
findValueByAttrName(org.apache.commons.configuration.tree.ConfigurationNode node,
String attrName)
通过属性名得到属性的值
|
static List<String> |
getChildValues(org.apache.commons.configuration.tree.ConfigurationNode superNode,
String subNodeName) |
static Element |
getElementByTagName(Document doc,
String tagName)
通过标签名得到第一个元素
|
static String |
getElementValue(Element element)
得到元素的值
|
static org.apache.commons.configuration.tree.ConfigurationNode |
getFirstNodeByNodeName(org.apache.commons.configuration.tree.ConfigurationNode node,
String name)
通过名称得到指定节点下第一个元素
|
static Object |
getValueByXpath(Object beanObj,
String xpath)
通过xpath方式得到对象中的值
|
static XMLReader |
getXMLReader() |
static void |
mergexml(org.apache.commons.configuration.XMLConfiguration xml,
String path,
String addStr)
把xml字符加到 目标xml文件的指定的节点
|
static Document |
parserDocment(String src)
解析XML文档
|
public static XMLReader getXMLReader()
public static final Document parserDocment(String src) throws ProjectException
src - 要解析的字符串ProjectException - 解析错误public static Element getElementByTagName(Document doc, String tagName)
doc - 文档tagName - 标签名public static final String findValueByAttrName(org.apache.commons.configuration.tree.ConfigurationNode node, String attrName)
node - 含有属性的节点attrName - 属性名public static String getElementValue(Element element)
element - 文档元素public static final org.apache.commons.configuration.tree.ConfigurationNode getFirstNodeByNodeName(org.apache.commons.configuration.tree.ConfigurationNode node,
String name)
node - 指定节点name - 子节点名称public static Object getValueByXpath(Object beanObj, String xpath)
beanObj - 要取值的对象xpath - 取值 xpath 路径public static List<String> getChildValues(org.apache.commons.configuration.tree.ConfigurationNode superNode, String subNodeName)
Copyright © 2017. All rights reserved.