packagecom.duosen.gate.utils;
@H_301_5@
importjava.io.InputStream;
@H_301_5@
importjava.text.MessageFormat;
@H_301_5@
importjavax.xml.parsers.SAXParser;
@H_301_5@
importorg.dom4j.Document;
@H_301_5@
importorg.dom4j.DocumentException;
@H_301_5@
importorg.dom4j.Element;
@H_301_5@
importorg.dom4j.io.SAXReader;
@H_301_5@
importorg.jdom.input.SAXBuilder;
@H_301_5@
/**
@H_301_5@
*@项目名称:56gate
@H_301_5@
*@类名称:XMLUtils
@H_301_5@
*@类描述:
@H_301_5@
*@创建人:liliang
@H_301_5@
*@创建时间:2013-10-12下午05:03:31
@H_301_5@
*@修改人:liliang
@H_301_5@
*@修改时间:2013-10-12下午05:03:31
@H_301_5@
*@修改备注:
@H_301_5@
*@version1.0
@H_301_5@
*/
@H_301_5@
publicclassXMLUtils{
@H_301_5@
@H_301_5@
privatestaticSAXReaderreader=newSAXReader();
@H_301_5@
privatestaticDocumentdom=null;
@H_301_5@
publicstaticDocumentload(StringfileName){
@H_301_5@
InputStreamin=PropertiesHandler.class.getClassLoader()
@H_301_5@
.getResourceAsStream(PropertiesHandler.PROP_DIR+fileName);
@H_301_5@
try{
@H_301_5@
dom=reader.read(in);
@H_301_5@
}catch(DocumentExceptione){
@H_301_5@
e.printStackTrace();
@H_301_5@
}
@H_301_5@
returndom;
@H_301_5@
}
@H_301_5@
@H_301_5@
@H_301_5@
publicstaticvoidmain(String[]args){
@H_301_5@
Documentdom=load("pushInfo.xml");
@H_301_5@
Stringcontent=dom.getRootElement().element("sourceGoodsSMS").element("content").getText();
@H_301_5@
Stringdetail=MessageFormat.format(content,
@H_301_5@