Java XML QName Create toQName(Map setProps)

Here you can find the source of toQName(Map setProps)

Description

to Q Name

License

Apache License

Declaration

public static Map<QName, String> toQName(Map<String, String> setProps) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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 {
    /**/*from   ww w .  j  a va2  s  .  c  om*/
     * 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);
    }
}

Related

  1. createQName(String qualifiedName, Node node)
  2. createQNameWithCustomNamespace(String key)
  3. getEmptyQName()
  4. string2qname(String name)
  5. stringToQName(String s)
  6. toQName(NamespaceContext namespaceContext, String qualifiedName)
  7. toQName(String namespaceUri, String qualifiedName)
  8. toQName(String s)
  9. toQNameArray(String[] array)