Android XML Attribute Set clearAttributes(Attributes attributes, Map tagCache)

Here you can find the source of clearAttributes(Attributes attributes, Map tagCache)

Description

I should have documented these properly when I first wrote them.

License

Open Source License

Parameter

Parameter Description
key a parameter
attributes a parameter

Declaration

public static void clearAttributes(Attributes attributes,
        Map<String, Integer> tagCache) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Map;
import org.xml.sax.Attributes;

public class Main {
    /**/* w  w  w.  j  av  a  2 s.co  m*/
     * I should have documented these properly when I first wrote them.
     * It looks like tagCache is initialized by clearAttributes and then
     * accessed by getAttribute
     * @param key
     * @param attributes
     * @return
     */
    public static void clearAttributes(Attributes attributes,
            Map<String, Integer> tagCache) {
        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);
        }

    }
}

Related

  1. setXmlAttributeValue(Document xml, Element elem, String name, String value)
  2. addElementWithTagAttr(StringBuffer out, String tag, String content, String[] attr)