List of utility methods to do XML Attribute Get
String | getAttrNS(Node node, String nameSpace, String attrName) get Attr NS final NamedNodeMap attrNode = node.getAttributes(); if (attrNode == null) { return null; final Node valueNode = attrNode.getNamedItemNS(nameSpace, attrName); if (valueNode == null) { return null; return valueNode.getNodeValue(); |
Attr[] | getAttrs(Element elem) get Attrs NamedNodeMap attrMap = elem.getAttributes(); Attr[] attrArray = new Attr[attrMap.getLength()]; for (int i = 0; i < attrMap.getLength(); i++) attrArray[i] = (Attr) attrMap.item(i); return attrArray; |
Attr[] | getAttrs(Element elem) get Attrs NamedNodeMap attrMap = elem.getAttributes(); Attr[] attrArray = new Attr[attrMap.getLength()]; for (int i = 0; i < attrMap.getLength(); i++) attrArray[i] = (Attr) attrMap.item(i); return attrArray; |
String | getAttrsAsString(Node node) get Attrs As String if (node == null) return ""; NamedNodeMap attrs = node.getAttributes(); StringBuilder val = new StringBuilder(); if (attrs != null) { for (int i = 0; i < attrs.getLength(); i++) { Node nval = attrs.item(i); if (nval != null) { ... |
String | getAttrString(Element elem, String localName) Returns the String value of the unqualified attribute with the given local name belonging to the given element, or null if the attribute is not present. Attr attr = elem.getAttributeNodeNS(null, localName);
String value = (attr != null) ? attr.getValue() : null;
return value;
|
String | getAttrVal(final NamedNodeMap nnm, final String name) Return the attribute value of the named attribute from the given map. Node nmAttr = nnm.getNamedItem(name); if ((nmAttr == null) || (absent(nmAttr.getNodeValue()))) { return null; return nmAttr.getNodeValue(); |
String | getAttrValue(NamedNodeMap attrs, String attrName) get Attr Value if (attrs == null || attrName == null) { return null; String attrValue = null; Node attrNode = attrs.getNamedItem(attrName); if (attrNode == null || Node.ATTRIBUTE_NODE != attrNode.getNodeType()) { return null; attrValue = attrNode.getNodeValue(); return attrValue; |
String | getAttrvalue(Node item, String name, boolean ignoreNs) get Attrvalue NamedNodeMap attributes = item.getAttributes(); int numAttrs = attributes.getLength(); for (int i = 0; i < numAttrs; i++) { Attr attr = (Attr) attributes.item(i); String attrName = attr.getNodeName(); String NSName = attr.getNamespaceURI(); if (ignoreNs) { if ((attrName.indexOf(":" + name) != -1) || (name.equals(attrName))) ... |
String | getAttrValue(Node n, String name) get Attr Value NamedNodeMap attrs = n.getAttributes();
return (attrs.getNamedItem(name) != null) ? attrs.getNamedItem(name).getNodeValue() : null;
|
String | getAttrValuesByName(Element ele, String attributeName) get Attr Values By Name return ele.getAttribute(attributeName);
|