public class XmlLoader extends Object
| 构造器和说明 |
|---|
XmlLoader() |
XmlLoader(Map<String,String> xmlFiles)
Description:
文件列表参数的构造方法 |
XmlLoader(String xmlRoot)
Description:
文件根目录构造方法 |
| 限定符和类型 | 方法和说明 |
|---|---|
org.dom4j.Element |
findElement(org.dom4j.Element searchedElement,
String targetNodePrefix)
Description:
用于从一个节点中定向找其子节点,通常同名的子节不会出现多个,如果出现多个,则返回第一个 |
org.dom4j.Element |
findElement(org.dom4j.Element searchedElement,
String targetNodePrefix,
String targetNodeAttributeName,
String targetNodeAttributeValue)
Description:
从一个Document对象的节点Element中找到指定的节点对象 |
List<org.dom4j.Element> |
findElementList(org.dom4j.Element searchedElement,
String targetNodePrefix,
String targetNodeAttributeName,
String targetNodeAttributeValue)
Description:
从一个Document对象的节点Element中找到指定的节点对象 |
void |
flush()
Description:
刷新已经加载的XML模板。 |
String |
getAttributeValue(org.dom4j.Element element,
String attributeName)
Description:
根据节点属性名获取属性值 |
org.dom4j.Document |
getXml(String key)
Description:
根据Key值从缓存中获取Document对象 |
Map<String,String> |
getXmlFiles() |
String |
getXmlRoot() |
void |
loadXmlWithMap(Map<String,String> xmlFiles)
Description:
使用Dom4j加载XML到内存中,加载的文件为传入MAP中的文件,缓存中KEY的值为传入MAP的KEY值 |
void |
loadXmlWithRoot(String xmlRoot)
Description:
使用Dom4j加载XML到内存中,加载的文件为传入目录中的所有XML文件,缓存中KEY的值为XML根节点NAME属性的值 |
void |
removeAll()
Description:
清空缓存中的Document对象 |
void |
removeXml(String key)
Description:
从MAP中删除一个已存在的Document对象 |
void |
setXmlFiles(Map<String,String> xmlFiles) |
static void |
setXmlMap(Map<String,org.dom4j.Document> xmlMap) |
void |
setXmlRoot(String xmlRoot) |
public XmlLoader()
public XmlLoader(String xmlRoot)
xmlRoot - public void loadXmlWithMap(Map<String,String> xmlFiles)
xmlFiles - public void loadXmlWithRoot(String xmlRoot)
xmlRoot - public org.dom4j.Element findElement(org.dom4j.Element searchedElement,
String targetNodePrefix,
String targetNodeAttributeName,
String targetNodeAttributeValue)
searchedElement - 被找的节点对象,源对象targetNodePrefix - 要找的节点名称targetNodeAttributeName - 要找的节点属性名称targetNodeAttributeValue - 要找的节点履性值public List<org.dom4j.Element> findElementList(org.dom4j.Element searchedElement, String targetNodePrefix, String targetNodeAttributeName, String targetNodeAttributeValue)
searchedElement - 被找的节点对象,源对象targetNodePrefix - 要找的节点名称targetNodeAttributeName - 要找的节点属性名称targetNodeAttributeValue - 要找的节点履性值public org.dom4j.Element findElement(org.dom4j.Element searchedElement,
String targetNodePrefix)
searchedElement - targetNodePrefix - public String getAttributeValue(org.dom4j.Element element, String attributeName)
element - attributeName - public void flush()
public void removeXml(String key)
key - public void removeAll()
public org.dom4j.Document getXml(String key)
key - public String getXmlRoot()
public void setXmlRoot(String xmlRoot)
Copyright © 2016. All rights reserved.