Java XML Attribute Set attrbiuteToMap( NamedNodeMap attributes)

Here you can find the source of attrbiuteToMap( NamedNodeMap attributes)

Description

attrbiute To Map

License

Apache License

Declaration

private static Map<String, String> attrbiuteToMap(
            NamedNodeMap attributes) 

Method Source Code

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

import java.util.LinkedHashMap;

import java.util.Map;

import org.w3c.dom.NamedNodeMap;

public class Main {
    private static Map<String, String> attrbiuteToMap(
            NamedNodeMap attributes) {
        if (attributes == null)
            return new LinkedHashMap<String, String>();
        Map<String, String> result = new LinkedHashMap<String, String>();
        for (int i = 0; i < attributes.getLength(); i++) {
            result.put(attributes.item(i).getNodeName(), attributes.item(i)
                    .getNodeValue());//from w w  w.java 2  s.  com
        }
        return result;
    }
}

Related

  1. attr(Element element, String name)
  2. attr(Element element, String name)
  3. attribute(Element element, String attrName)
  4. attribute(Node node, String... attributes)
  5. attributeBooleanGet(Element e, String name, boolean defaultValue)
  6. attributeBooleanSet(Element base, String name, boolean value, boolean defaultValue)