List of utility methods to do XML Attribute from Element
float | getFloatAttribute(Element element, String name) get Float Attribute String s = getTrimmedAttribute(element, name);
return s.isEmpty() ? 0f : Float.parseFloat(s);
|
Float | getFloatAttribute(String name, Element el) Gets the value of the DOM element's attribute with the given name as a Float, or null if the value is not a float. return stringToFloat(getAttribute(name, el));
|
String | getHeadAttr(Element annotU, String attrName) get Head Attr NodeList nl = annotU.getElementsByTagName("head"); if (nl == null) return ""; Element head = (Element) nl.item(0); if (head == null) return ""; NodeList notes = head.getElementsByTagName("note"); for (int i = 0; i < notes.getLength(); i++) { ... |
Attr | getIdAttribute(Element domElement) Gets the ID attribute of a DOM element. if (!domElement.hasAttributes()) { return null; NamedNodeMap attributes = domElement.getAttributes(); Attr attribute; for (int i = 0; i < attributes.getLength(); i++) { attribute = (Attr) attributes.item(i); if (attribute.isId()) { ... |
String | getIdAttributeValue(Element elem, String name) Returns the attribute value for the attribute with the specified name. Attr attr = elem.getAttributeNodeNS(null, name); if (attr != null && !attr.isId()) { elem.setIdAttributeNode(attr, true); return (attr == null) ? null : attr.getValue(); |
int | getIntAttr(Element elem, String attName) Return the value of an integer attribute or zero return getIntAttr(elem, attName, 0);
|
int | getIntAttribute(Element el, String name) get Int Attribute String s = el.getAttribute(name); if (s != null && s.length() > 0) { return Integer.parseInt(s); return 0; |
int | getIntAttribute(Element elem, String attName, boolean mandatory, int defaultValue) getIntAttribute purpose. String attValue = getAttribute(elem, attName, mandatory); if (!mandatory && (attValue == null)) { return defaultValue; try { return Integer.parseInt(attValue); } catch (Exception ex) { if (mandatory) { ... |
int | getIntAttribute(Element elem, String attName, boolean mandatory, int defaultValue) getIntAttribute purpose. String attValue = getAttribute(elem, attName, mandatory); if (!mandatory && (attValue == null)) { return defaultValue; try { return Integer.parseInt(attValue); } catch (Exception ex) { if (mandatory) { ... |
int | getIntAttribute(Element element, String attribute) get Int Attribute String value = element.getAttribute(attribute); int result = 1; if (value != null && value.length() != 0) { result = Integer.parseInt(value); return result; |