Java XML QName convertQNameListToNamespaceToLocalNameList( List list)

Here you can find the source of convertQNameListToNamespaceToLocalNameList( List list)

Description

convert Q Name List To Namespace To Local Name List

License

Open Source License

Declaration

public static SortedMap<String, SortedSet<String>> convertQNameListToNamespaceToLocalNameList(
            List<QName> list) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 University of Stuttgart.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and the Apache License 2.0 which both accompany this distribution,
 * and are available at http://www.eclipse.org/legal/epl-v10.html
 * and http://www.apache.org/licenses/LICENSE-2.0
 *
 * Contributors://  w ww  .ja  va  2 s  .  c o  m
 *     Oliver Kopp - initial API and implementation
 *******************************************************************************/

import java.util.List;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.xml.namespace.QName;

public class Main {
    public static SortedMap<String, SortedSet<String>> convertQNameListToNamespaceToLocalNameList(
            List<QName> list) {
        SortedMap<String, SortedSet<String>> res = new TreeMap<>();
        for (QName qname : list) {
            SortedSet<String> localNameSet = res.computeIfAbsent(qname.getNamespaceURI(), k -> new TreeSet<>());
            localNameSet.add(qname.getLocalPart());
        }
        return res;
    }
}

Related

  1. compareQName(QName qname, Node node)
  2. compareRelation(QName a, QName b)
  3. compareWithOutNamespace(QName value, QName tagName)
  4. concatAttributes(List startElements, QName attrName)
  5. contains(final QName[] qnames, final QName qname, final String defaultNamespace)
  6. convertQNameToFullname(QName qn)
  7. convertToQName(String source, String nameSpaceuri)
  8. copyQName(QName inName)
  9. crackQName(String qName)