List of utility methods to do XML Attribute Get
boolean | getAttributeBoolean(Element el, String label) get Attribute Boolean String s = el.getAttribute(label);
return Boolean.valueOf(s).booleanValue();
|
boolean | getAttributeBoolean(final Element element, final String name) Locate attribute tagged 'name', return its boolean value. String s = element.getAttribute(name); return s.equalsIgnoreCase("true"); |
Boolean | getAttributeBoolean(final Node node, final String name, final Boolean defaultValue) get Attribute Boolean String value = getAttributeText(node, name); if (value == null) return defaultValue; if ("yes".equalsIgnoreCase(value)) return true; if ("no".equalsIgnoreCase(value)) return false; return Boolean.parseBoolean(value); ... |
Boolean | getAttributeBoolean(Node node, String attributeName) get Attribute Boolean String value = getAttribute(node, attributeName, null);
return (value == null ? null : Boolean.valueOf(value));
|
boolean | getAttributeBoolean(Node node, String name) Gets the boolean value of a named attribute of a node. String s = getAttributeString(node, name); if (s != null && s.length() > 0) { return (s.compareToIgnoreCase("1") == 0); } else return false; |
boolean | getAttributeBooleanByName(NamedNodeMap nnm, String name) Searches throgh the passed NamedNodeMap for an attribute. for (int i = 0; i < nnm.getLength(); i++) { Attr attr = (Attr) nnm.item(i); if (attr.getName().equalsIgnoreCase(name)) { String tmp = attr.getValue().toLowerCase(); if (tmp.equalsIgnoreCase("true")) return true; if (tmp.equalsIgnoreCase("false")) return false; ... |
boolean | getAttributeBooleanByName(NamedNodeMap nnm, String name) Searches throgh the passed NamedNodeMap for an attribute. for (int i = 0; i < nnm.getLength(); i++) { Attr attr = (Attr) nnm.item(i); if (attr.getName().equalsIgnoreCase(name)) { String tmp = attr.getValue().toLowerCase(); if (tmp.equalsIgnoreCase("true")) return true; if (tmp.equalsIgnoreCase("false")) return false; ... |
String | getAttributeByIndex(final Element element, final int index) get Attribute By Index return getAttribute(getElementsFromNodeList(element.getChildNodes()), index);
|
String | getAttributeByLocalName(XMLStreamReader reader, String localName) get Attribute By Local Name String result = ""; for (int i = 0; i < reader.getAttributeCount(); i++) { QName attribute = reader.getAttributeName(i); if (attribute != null && attribute.getLocalPart().equals(localName)) { result = reader.getAttributeValue(i); return result; ... |
String | getAttributeByName(final List get Attribute By Name for (final Element element : elements) { final String value = getAttributeFromElement(element, attributeName); if (value != null) { return value; return null; |