适用版本:所有版本;
完整类名:com.lc.ibps.base.core.util.Dom4jUtil

适用哪些服务?

  1. oauth服务
  2. platform服务
  3. business服务
  4. 通过business或skeleton创建的服务

方法介绍

loadXml

  1. 将符合格式的xml字符串 转化成 org.dom4j.Document
  2. 方法定义public static Document loadXml(String xml)
  3. 示例
String input = "<?xml><import resource=\"ibps-resources.xml\"/></beans>";
org.dom4j.Document doc = Dom4jUtil.loadXml(input);

load

  1. 加载一个XML文件转成 org.dom4j.Document
  2. 方法定义public static Document load(String filename, String encode)
  3. 示例
String input = "c:\\users.xml";
org.dom4j.Document doc = Dom4jUtil.load(input,"utf-8");

loadXml

  1. 按指定编码转化字符串为 org.dom4j.Document
  2. 方法定义public static Document loadXml(String xml, String encode) throws UnsupportedEncodingException
  3. 示例
String input = "<?xml><import resource=\"ibps-resources.xml\"/></beans>";
org.dom4j.Document doc = Dom4jUtil.loadXml(input,"utf-8");

loadXml

  1. 根据输入流返回 org.dom4j.Document
  2. 方法定义public static Document loadXml(InputStream is)
  3. 示例
String input = "c:\\users.xml";
InputStream stream = new FileInputStream(input);
org.dom4j.Document doc = Dom4jUtil.loadXml(stream);

loadXml

  1. 根据输入流并指定编码返回 org.dom4j.Document
  2. 方法定义public static Document loadXml(InputStream is, String charset)
  3. 示例
String input = "c:\\users.xml";
InputStream stream = new FileInputStream(input);
org.dom4j.Document doc = Dom4jUtil.loadXml(stream,"utf-8");

write

  1. 将DOM写入到文件
  2. 方法定义public static void write(Document document, String fileName)
  3. 示例
String input = "c:\\users.xml";
Dom4jUtil.write(document,input);

write

  1. 将xml字符串写入到文件
  2. 方法定义public static void write(String str, String fileName)
  3. 示例
String xml = "<?xml><import resource=\"ibps-resources.xml\"/></beans>";
String input = "c:\\users.xml";
Dom4jUtil.write(xml,input);

待完善…

文档更新时间: 2021-12-27 16:38   作者:Eddy