Axis2中的操作OMElement【取得某一個節點下的子節點】
阿新 • • 發佈:2019-02-11
private static OMElement value = null; public static OMElement getTheNodeValue(OMElement in, String nodeName) { try { Iterator desc = in.getChildElements(); value = null; while (desc.hasNext()) { OMElement element = (OMElement) desc.next(); OMElement e = element .getFirstChildWithName(new QName(nodeName)); if (e == null && element.getQName().equals(new QName(nodeName))) { e = element; } if (e != null) { value = e.getFirstElement(); break; } else { if (value == null) { getTheNodeValue(element, nodeName); } } } return value; } catch (Exception e) { return null; } }