The list of methods to do XML Attribute Exist are organized into topic(s).
boolean
hasAttribute(Element ele, String attrName) judge whether element has an attribute named attrName
NamedNodeMap map = ele.getAttributes();
for (int i = 0; i < map.getLength(); i++) {
Node attr = map.item(i);
if (attr.getNodeName().equalsIgnoreCase(attrName)) {
return true;
return false;
...
boolean
hasAttribute(Element element, String value) has Attribute
NamedNodeMap attributes = element.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node node = attributes.item(i);
if (value.equals(node.getNodeValue())) {
return true;
return false;
...
boolean
hasAttribute(final Node node, final String name) Indicates if the passed node has the named atribute
if (name == null || node == null)
return false;
final NamedNodeMap nnm = node.getAttributes();
for (int i = 0; i < nnm.getLength(); i++) {
Attr attr = (Attr) nnm.item(i);
if (attr.getName().equalsIgnoreCase(name)) {
return true;
return false;
boolean
hasAttribute(Node n, String attr) has Attribute
NamedNodeMap attrs = n.getAttributes();
if (attrs == null)
return false;
Node ret = attrs.getNamedItem(attr);
if (ret == null)
return false;
else
return true;
...