新手向高手求点代码, 使用DOM4J 解析XML 的
XML是一个SOAP, 内容如下:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><ACIC_MessageBrokerService xmlns="http://www.ACIC.MessageBrokerService.com/"><ServiceID>0428000001</ServiceID><obj> <anyType xsi:type="xsd:string">par1</anyType> <anyType xsi:type="xsd:int">0</anyType> <anyType xsi:type="xsd:boolean">true</anyType></obj></ACIC_MessageBrokerService></soap:Body></soap:Envelope>
Element obj = root.element("Body").element("ACIC_MessageBrokerService").element("obj"); List<Element> types = obj.elements("anyType"); for (Element elem : types) { System.out.println(elem.getName() + ": " + elem.getText()); }