用axiom解析xml,axis2中常用
public static Map<String,String> getResults(OMElement element) { if (element == null) { return null; } Iterator<OMNode> iter = element.getChildElements(); Map<String,String> map = new HashMap<String,String>(); while (iter.hasNext()) { OMNode omNode = (OMNode) iter.next(); if (omNode.getType() == OMNode.ELEMENT_NODE) { OMElement omElement = (OMElement) omNode; String key = omElement.getLocalName().trim(); System.out.println("键: " + key); String value = omElement.getText().trim(); System.out.println("值: " + value); map.put(key,value); } } return map; }转载 http://blog.csdn.net/mengxianhua/article/details/8024666