List of utility methods to do XML Attribute Get
Map | extractAttributesFromTag(String tag) Extracts all attributes from tags, for example if (tag == null) { return null; Matcher m = getMatcher(tag, " .*(?=[>])"); if (m.find() == false) { return null; Map<String, String> attributes = new HashMap<String, String>(); ... |
String | getAttribute(String key, Attributes attributes, Map get Attribute Integer value = tagCache.get(key); if (null == value || value.intValue() == -1) { return null; } else { return attributes.getValue(value); |
String | getAttributesValue(Attributes attrs, String name) get Attributes Value for (int i = 0; i < attrs.getLength(); ++i) { if (attrs.getLocalName(i).equals(name)) { return attrs.getValue(i); return null; |
String | getXmlAttribute(Context context, XmlResourceParser xml, String name) get Xml Attribute int resId = xml.getAttributeResourceValue(null, name, 0); if (resId == 0) { return xml.getAttributeValue(null, name); } else { return context.getString(resId); |
String | getNodeAttributeOrDefault(Node node, String name, String defaultValue) get Node Attribute Or Default NamedNodeMap attributes = node.getAttributes(); Node valueNode = attributes.getNamedItem(name); String value = defaultValue; if (valueNode != null) value = valueNode.getNodeValue(); return value; |
String | getNodeAttributeOrFail( Node node, String name, ExceptionType e) get Node Attribute Or Fail NamedNodeMap attributes = node.getAttributes(); Node valueNode = attributes.getNamedItem(name); if (valueNode == null) throw e; return valueNode.getNodeValue(); |
String | getNodeAttributeOrFail( Node node, String name, T e) Retrieves the value for a xml Node attribute or fails if not found. NamedNodeMap attributes = node.getAttributes(); Node valueNode = attributes.getNamedItem(name); if (valueNode == null) throw e; return valueNode.getNodeValue(); |