Android XML Element Attribute Get processAnyAttributes(Element element, Map anyAttributes)

Here you can find the source of processAnyAttributes(Element element, Map anyAttributes)

Description

Processes any attributes and add them into the element.

License

LGPL

Parameter

Parameter Description
element the element where to add the attributes.
anyAttributes the any attributes to process.

Declaration

public static void processAnyAttributes(Element element,
        Map<QName, String> anyAttributes) 

Method Source Code

//package com.java2s;
/*/*  w  w w. j  av  a2  s .  c  o  m*/
 * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

import java.util.*;
import javax.xml.namespace.*;
import org.w3c.dom.*;

public class Main {
    /**
     * Processes any attributes and add them into the element.
     *
     * @param element       the element where to add the attributes.
     * @param anyAttributes the any attributes to process.
     */
    public static void processAnyAttributes(Element element,
            Map<QName, String> anyAttributes) {
        for (Map.Entry<QName, String> attribute : anyAttributes.entrySet()) {
            String localName = attribute.getKey().getLocalPart();
            String prefix = attribute.getKey().getPrefix();
            String namespace = attribute.getKey().getNamespaceURI();
            element.setAttributeNS(namespace, prefix + ":" + localName,
                    attribute.getValue());
        }
    }
}

Related

  1. getAttributeValue(Element elem, String name)
  2. getBooleanAttribute(Element el, String name)
  3. getIntAttribute(Element el, String name)
  4. getNodeAttrValue(Element parent, String nodeName, String attrName)