在接口 代码
DocumentBuilderFactory domfac=DocumentBuilderFactory.newInstance();
DocumentBuilder dombuilder=domfac.newDocumentBuilder();request.setCharacterEncoding("UTF-8");
Document doc= dombuilder.parse(request.getInputStream());
String orderid = doc.getElementsByTagName("orderid").item(0).getFirstChild().getNodeValue();
//遍历所有节点
NodeList list=doc.getElementsByTagName("*");
for(int i=0;i<list.getLength();i++){
String name=list.item(i).getNodeName();
String value=list.item(i).getTextContent();
System.out.println(" Name : "+name+" value : "+value);
}
(先记录一下,有时间完善)
原文链接:https://www.f2er.com/xml/297403.html