|
|
|
package com.fanruan.api.xml;
|
|
|
|
|
|
|
|
import com.fr.data.core.DataCoreXmlUtils;
|
|
|
|
import com.fr.data.impl.Connection;
|
|
|
|
import com.fr.stable.xml.*;
|
|
|
|
import com.fr.general.xml.GeneralXMLTools;
|
|
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
|
|
public class XmlKit {
|
|
|
|
/**
|
|
|
|
* 从输入流中读取对象
|
|
|
|
* @param xmlReadable xml读取对象
|
|
|
|
* @param inputStream xml输入流
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public static void readInputStreamXML(XMLReadable xmlReadable, InputStream inputStream) throws Exception {
|
|
|
|
XMLTools.readInputStreamXML(xmlReadable, inputStream);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 从输入源中读取xml
|
|
|
|
* @param reader 输入源
|
|
|
|
* @return xml文件
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public static XMLable readXMLable(XMLableReader reader) {
|
|
|
|
return GeneralXMLTools.readXMLable(reader);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 写XMLable
|
|
|
|
* @param writer 输出源
|
|
|
|
* @param xml xml文件
|
|
|
|
* @param tagName 标签名
|
|
|
|
* @return 节点名
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public static void writeXMLable(XMLPrintWriter writer, XMLable xml, String tagName) {
|
|
|
|
GeneralXMLTools.writeXMLable(writer, xml, tagName);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 读取connection对象
|
|
|
|
* @param reader XMLableReader对象
|
|
|
|
* @return Connection对象
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public static Connection readXMLConnectionMap(XMLableReader reader) {
|
|
|
|
return DataCoreXmlUtils.readXMLConnectionMap(reader);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 写connection对象
|
|
|
|
* @param writer XMLPrintWriter对象
|
|
|
|
* @param connection Connection对象
|
|
|
|
*/
|
|
|
|
public static void writeXMLConnection(XMLPrintWriter writer, Connection connection) {
|
|
|
|
DataCoreXmlUtils.writeXMLConnection(writer, connection);
|
|
|
|
}
|
|
|
|
}
|