使用dom4j构建document

public String buildReturnDocument(String message,String season) {
		org.dom4j.Document document = DocumentHelper.createDocument();
		org.dom4j.Element wsDataElement = document.addElement("WSData");
		wsDataElement.addComment("深圳电信vbao系统返回网银结算消息");
		
		org.dom4j.Element successElement =  wsDataElement.addElement("success");
		successElement.setText(message);
		
		org.dom4j.Element reasonElement = wsDataElement.addElement("reason");
		reasonElement.setText(season);
		document.setXMLEncoding("GBK");
		//document.addDocType("WSData",null,"vbao.dtd");
		
		return document.asXML();
}
 

 

你可能感兴趣的:(电信)