List of utility methods to do XML Attribute Get
String | getAttributeValue(Node node, String attributeName) Get the attribute value of the node. Node attribute = node.getAttributes().getNamedItem(attributeName); if (attribute != null) { return attribute.getNodeValue(); } else { return null; |
int | getAttributeValue(Node node, String attributeName, int defaultValue) get the attribute with the given name from the given node as an int value NamedNodeMap nnm = node.getAttributes(); Node attribute = nnm.getNamedItem(attributeName); if (attribute == null) { return defaultValue; } else try { return Integer.parseInt(attribute.getNodeValue()); } catch (NumberFormatException e) { ... |
String | getAttributeValue(Node node, String attrName) Returns string value of the named attribute of the node. Node attr = node.getAttributes().getNamedItem(attrName);
return attr == null ? null : attr.getNodeValue();
|
String | getAttributeValue(Node node, String attrName) Gets the value of a specific attribute attached to the given node if (node == null) return null; ; NamedNodeMap map = node.getAttributes(); if (map != null && map.getNamedItem(attrName) != null) return map.getNamedItem(attrName).getTextContent(); else return null; ... |
String | getAttributeValue(Node node, String name) get Attribute Value Node attribute = getAttribute(node, name); if (attribute != null) { return attribute.getNodeValue(); return null; |
String | getAttributeValue(Node node, String name) get Attribute Value Node attr = getAttribute(node, name);
return (attr != null) ? attr.getNodeValue() : null;
|
String | getAttributeValue(Node node, String name) Get the value of a node's attribute. if (node instanceof Document) node = ((Document) node).getDocumentElement(); if (!(node instanceof Element)) return ""; return ((Element) node).getAttribute(name); |
boolean | getAttributeValue(Node node, String name, boolean defaultValue) get Attribute Value String str = getAttributeValue(node, name); if (str == null) { return defaultValue; } else { return "true".equals(str); |
String | getAttributeValue(Node node, String name, String defaultValue) get Attribute Value try { return node.getAttributes().getNamedItem(name).getNodeValue(); } catch (Exception ex) { return defaultValue; |
String | getAttributeValue(Node sNode, String attribName) Utility method to fetch the attribute value from the given element node String value = null; NamedNodeMap attrs = sNode.getAttributes(); if (attrs != null) { Node attr = attrs.getNamedItem(attribName); if (attr != null) { value = attr.getNodeValue(); return value; |