Here you can find the source of toQName(Map
public static Map<QName, String> toQName(Map<String, String> setProps)
//package com.java2s; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; public class Main { /**// www . ja v a 2 s.c o m * Default namespace prefix */ public static final String CUSTOM_NAMESPACE_PREFIX = "s"; /** * Default namespace URI */ public static final String CUSTOM_NAMESPACE_URI = "SAR:"; /** */ public static Map<QName, String> toQName(Map<String, String> setProps) { if (setProps == null) { return Collections.emptyMap(); } Map<QName, String> result = new HashMap<QName, String>( setProps.size()); for (Map.Entry<String, String> entry : setProps.entrySet()) { result.put(createQNameWithCustomNamespace(entry.getKey()), entry.getValue()); } return result; } /** */ public static List<QName> toQName(List<String> removeProps) { if (removeProps == null) { return Collections.emptyList(); } List<QName> result = new ArrayList<QName>(removeProps.size()); for (String entry : removeProps) { result.add(createQNameWithCustomNamespace(entry)); } return result; } /** * @param key Local element name. */ public static QName createQNameWithCustomNamespace(String key) { return new QName(CUSTOM_NAMESPACE_URI, key, CUSTOM_NAMESPACE_PREFIX); } }