Android QName Create toQName(Map setProps)

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

Description

to Q Name

Declaration

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

Method Source Code

//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);
    }
}

Related

  1. createQNameWithCustomNamespace(String key)
  2. createQNameWithDefaultNamespace(String key)
  3. toQName(List removeProps)