Java tutorial
//package com.java2s; /* * 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()); } } }