List of utility methods to do XML Attribute Get
String | getAttributeStringValue(Node htmlForm, String attributeName, String defaultValue) get Attribute String Value Node item = htmlForm.getAttributes().getNamedItem(attributeName);
return item == null ? defaultValue : item.getNodeValue();
|
String | getAttributeStringValue(String attribute, NamedNodeMap namedNodeMap) get Attribute String Value Node node = namedNodeMap.getNamedItem(attribute); if (node != null) { return node.getTextContent(); return null; |
Map | getAttributesValues(final StartElement element) get Attributes Values final Map<String, String> values = new HashMap<>(4); @SuppressWarnings("unchecked") final Iterator<Attribute> attributes = element.getAttributes(); while (attributes.hasNext()) { final Attribute attr = attributes.next(); values.put(attr.getName().getLocalPart(), attr.getValue()); return values; ... |
Map | getAttributeTable(Element element) get Attribute Table NamedNodeMap attrs = element.getAttributes(); if (attrs == null) { return Collections.emptyMap(); int numAttrs = attrs.getLength(); Map<String, String> attributeTable = new HashMap<String, String>(numAttrs); for (int i = 0; i < numAttrs; i++) { Node na = attrs.item(i); ... |
String | getAttributeText(final Node node, final String name) get Attribute Text NamedNodeMap nnm = node.getAttributes(); if (nnm == null) return null; Node attr = nnm.getNamedItem(name); if (attr == null) return null; return attr.getNodeValue(); |
String | getAttributeTextContent(Node node, String attiribute_name) get Attribute Text Content Node attr = node.getAttributes().getNamedItem(attiribute_name); if (attr != null) { return attr.getTextContent(); return ""; |
String | getAttributeUri(Element leaf, Element parent, String defaultBaseUri) Get uri of a leaf element which is an attribute of its parent. return hasNamespace(leaf) && parent != null ? getSchemaUri(leaf, defaultBaseUri) : getSchemaUri(parent, defaultBaseUri) + "." + leaf.getNodeName(); |
String | getAttributeValue(@Nonnull final Element aElement, @Nonnull final String sAttrName) The latest version of XercesJ 2.9 returns an empty string for non existing attributes. return getAttributeValue(aElement, sAttrName, null);
|
String | getAttributeValue(Element e, String key) This returns the attribute value for the attribute of the input element with the given name and within no namespace. String value = null; NamedNodeMap map = e.getAttributes(); Node keyNode = map.getNamedItem(key); if (keyNode != null) { value = keyNode.getNodeValue(); return value; |
String | getAttributeValue(Element e, String name) Get an attribute value Node n = e.getAttributes().getNamedItem(name);
return (n != null) ? n.getNodeValue() : null;
|