Code example for Node

Methods: getAttributes

0
        * */ 
        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");