?? xmlutil.java
字號:
package com.talkweb.micp.icsp.parse;
import org.kxml.kdom.Document;
import org.kxml.parser.XmlParser;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
/**
* XMLUtil.java
* <p>標題: XML實用類</p>
* <p>描述: 根據文件路徑或流數據獲取XML文檔</p>
* <p>版權: Copyright (c) 2006</p>
* <p>公司: 湖南拓維信息系統股份有限公司</p>
* 作者: 郭勇華
* 版本: 1.0
*/
public class XMLUtil {
/**
* 獲取XML文檔
* @param strSmilName String SMIL文件路徑名
* @return Document SMIL(xml)文檔
*/
public Document getXMLDocment(String strSmilName){
XmlParser parser = null;
Document doc = new Document();
try {
InputStream in = this.getClass().getResourceAsStream(strSmilName);
InputStreamReader isr = new InputStreamReader(in);
parser = new XmlParser(isr);
doc.parse(parser);
return doc ;
}
catch (IOException ioe) {
System.err.println("XML Parsing Error: " + ioe);
ioe.printStackTrace();
return null;
}
finally{
parser = null;
doc = null;
}
}
/**
* 獲取XML文檔
* @param byteSmil byte[] SMIL流數據
* @return Document SMIL(xml)文檔
*/
public Document getXMLDocment(byte[] byteSmil){
XmlParser parser = null;
Document doc = new Document();
try {
java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(byteSmil);
InputStreamReader isr = new InputStreamReader(bais);
parser = new XmlParser(isr);
doc.parse(parser);
return doc ;
}
catch (IOException ioe) {
System.err.println("XML Parsing Error: " + ioe);
ioe.printStackTrace();
return null;
}
finally{
parser = null;
doc = null;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -