NamedNodeMap attributes = node.getAttributes(); if (attributes != null) { Node namedItem = attributes.getNamedItem(name); return namedItem != null ? namedItem.getNodeValue() : null; } return null; }
return getAttribute(node, name, null); }
    private String getAttribute(Node node, String name) {        NamedNodeMap attributes = node.getAttributes();        if (attributes != null) {            Node namedItem = attributes.getNamedItem(name);            return namedItem != null ? namedItem.getNodeValue() : null;        }        return null;    }