获取节点时候要从跟路径获取,你的 NodeList nodeList = doc.getElementsByTagName("soap:Body"); 这个是没错的,因为是跟节点,但是
NodeList nodeList = doc.getElementsByTagName("GetSysTime"); 这句话就错了,因为节点路径没有写,应该为
List
获取节点看我的方法多简单:
Element root = dc.getRootElement();//获取跟节点
Element cchild = root.getChild("soap:Body").getChild("GetSysTime").getChild("result").getChild("code");//获取子code节点
String checkerName = cchilded.getChildTextTrim("code");//获取值得大小
其他的也是一样的,获取节点