Android Utililty Methods XML Attribute Set

List of utility methods to do XML Attribute Set

Description

The list of methods to do XML Attribute Set are organized into topic(s).

Method

voidsetXmlAttributeValue(Document xml, Element elem, String name, String value)
set Xml Attribute Value
Attr a = xml.createAttribute(name);
a.setValue(value);
elem.getAttributes().setNamedItem(a);
voidclearAttributes(Attributes attributes, Map tagCache)
I should have documented these properly when I first wrote them.
final int attributesLength = attributes.getLength();
for (String key : tagCache.keySet()) {
    tagCache.put(key, -1);
for (int i = 0; i < attributesLength; i++) {
    String name = attributes.getLocalName(i);
    tagCache.put(name, i);
voidaddElementWithTagAttr(StringBuffer out, String tag, String content, String[] attr)
Add a tag with attributes to the StringBuffer out.
out.append("<").append(tag);
for (int i = 0; i < attr.length; i++) {
    out.append(" ").append(attr[i]);
out.append(">").append(content).append("</").append(tag)
        .append(">");