List of utility methods to do XML Attribute Read
int | readInt(Node node, String attributeName, int def) read Int try { return Integer.parseInt(node.getAttributes().getNamedItem(attributeName).getNodeValue()); } catch (Exception ex) { return def; |
int | readIntAttr(Element element, String attributeName, int defaultValue) read Int Attr String attributeValue = element.getAttribute(attributeName); try { return Integer.parseInt(attributeValue); } catch (NumberFormatException e) { return defaultValue; |
int | readIntegerAttribute(Element elem, String name, int defaultValue) read Integer Attribute int back = defaultValue; String str = elem.getAttribute(name); if (str != null) { if (str.length() > 0) { back = Integer.parseInt(str); return back; ... |
void | readNodeAttributes(Element elem, Object[] map) Read the attributes of elem. NamedNodeMap attrMap = elem.getAttributes(); for (int i = 0; i < attrMap.getLength(); i++) { Attr attr = (Attr) attrMap.item(i); String key = attr.getName(); for (int j = 0; j < map.length; j += 2) { if (map[j].equals(key)) { map[j + 1] = convert(attr.getValue(), (Class) map[j + 1]); |