List of utility methods to do XML Attribute Get
String | getAttribute(Element ownerElem, String attrName) Gets an attribute value of the given element. Attr attribute = ownerElem.getAttributeNode(attrName);
return attribute != null ? attribute.getValue() : null;
|
String | getAttribute(Element parent, String localName) get Attribute if (parent == null) { return null; Attr attribute = parent.getAttributeNode(localName); if (attribute != null) { return attribute.getValue(); } else { return null; ... |
String | getAttribute(Element parent, String localName, String namespaceURI) Returns the value of the named attribute of the current element. if (parent == null) { return null; Attr attribute; if (namespaceURI == null) { attribute = parent.getAttributeNode(localName); } else { attribute = parent.getAttributeNodeNS(namespaceURI, localName); ... |
String | getAttribute(File file, String attr) get Attribute Logger logger = Logger.getLogger("eu.excitementproject.eop.util.runner.ConfigFileUtils:getAttribute"); logger.info("Looking for a value for attribute: " + attr); Document configDoc = parse(file); NodeList sectionList = configDoc.getElementsByTagName(sectionTag); String value = findAttributeRec(sectionList, attr); if (value != null) { logger.info("Value for attribute " + attr + " : " + value); return value; |
String | getAttribute(final List get Attribute final Element element = elements.get(index); final NamedNodeMap attrs = element.getAttributes(); final Node item = attrs.getNamedItem("value"); if (item != null) { return item.getNodeValue(); return null; |
Attr | getAttribute(final Node iNode, final String iAttributeName) This method returns the attribute of the given node whose name matches the named value (iAttributeName) and a particular namespace (iNamespaceForAttr). Attr result = null; if (iNode != null) { NamedNodeMap attrList = iNode.getAttributes(); int numAttr = attrList.getLength(); Attr currentAttrNode = null; String currentNodeName = null; for (int k = 0; k < numAttr; k++) { currentAttrNode = (Attr) attrList.item(k); ... |
String | getAttribute(final Node n, final String attrName, final String defaultValue) get Attribute if (n.getAttributes().getNamedItem(attrName) != null) { return ((Attr) n.getAttributes().getNamedItem(attrName)).getValue(); return defaultValue; |
int | getAttribute(final Node node, final String attribname, final int def) get Attribute final String attr = getAttributeValue(node, attribname); if (attr != null) { return Integer.parseInt(attr); } else { return def; |
String | getAttribute(final Node node, final String attributeName) get Attribute final NamedNodeMap tmpMap = node.getAttributes(); if (tmpMap == null) { return null; final Node tmpNode = tmpMap.getNamedItem(attributeName); if (tmpNode == null) { return null; return tmpNode.getNodeValue(); |
Node | getAttribute(final Node node, final String name) get Attribute if (node == null) { throw new IllegalArgumentException("The node is null."); } else if (name == null || name.isEmpty()) { throw new IllegalArgumentException("The attribute's name is null or empty."); } else { final NamedNodeMap namedNodeMap = node.getAttributes(); if (namedNodeMap != null) { return namedNodeMap.getNamedItem(name); ... |