Code example for Element

Methods: getElementsByTagNameNS

0
        * <axis2ns1:feedback xmlns:axis2ns1="http://wso2.org/humantask/feedback" 
        * soapenv:actor="http://schemas.xmlsoap.org/soap/envelope/actor/feedback" axis2ns1:taskid="500" /> 
        * </soapenv:Header> 
        * */ 
        String taskID = null;
        NodeList nList = envelope.getElementsByTagNameNS(FEEDBACK_ATTRIBUTE_NAMESPACE, FEEDBACK_HEADER_LOCALNAME);
        if (nList.getLength() > 0) {
            Node nNode = nList.item(0);
            NamedNodeMap namedNodeMap = nNode.getAttributes();
            if (namedNodeMap.getLength() > 0) {
                Node attr = namedNodeMap.getNamedItemNS(FEEDBACK_ATTRIBUTE_NAMESPACE, FEEDBACK_ATTRIBUTE_NAME);
                taskID = attr.getTextContent();
            } 
        } 
        //String id = envelope.getAttributeNS(FEEDBACK_ATTRIBUTE_NAMESPACE, FEEDBACK_ATTRIBUTE_NAME); 
 
        if (taskID == null || taskID.equals("")) {
            NodeList nodeList = envelope.getElementsByTagNameNS("http://www.insurance.example.com/claims/schema", "response");
            if (nodeList.getLength() == 1) {
                Node ele = nodeList.item(0);
                taskID = ele.getTextContent();
            } else { 
                log.error("elements are > or < 1");