81,092
社区成员
发帖
与我相关
我的任务
分享
StringBuffer sb = new StringBuffer();
sb.append("<?xml version='1.0' encoding='UTF-8'?><CAPRoot><SessionHeader><ActionCode>1</ActionCode>");
sb.append("<TransactionID>17350201004150001007001</TransactionID><RspTime>20110223044205</RspTime>");
sb.append("<DigitalSign>");
sb.append("302C021446A714CEA8C0591EFEDF7CE1C1DD24F393");
sb.append("AC238D02147C1F5B0E45E6E7753C1A7ED369A63938D5DE3845");
sb.append("</DigitalSign><Response><RspType>8</RspType><RspCode>8004</RspCode>");
sb.append("<RspDesc>断言查询错误</RspDesc></Response></SessionHeader></CAPRoot>");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
Document document = dbf.newDocumentBuilder().parse(new java.io.ByteArrayInputStream(sb.toString().getBytes("utf-8")));
//System.out.println(document.toString());new InputSource(new StringReader(result.toString()))
// Document document = dbf.newDocumentBuilder().parse(new InputSource(new StringReader(sb.toString())));
Element root= document.getDocumentElement();
System.out.println(root.getNodeName());
NodeList list = root.getChildNodes();