Java XML Attribute Get getAttributes(Node node)

Here you can find the source of getAttributes(Node node)

Description

get Attributes

License

Open Source License

Declaration

public static Map<String, String> getAttributes(Node node) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Map;

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

import com.google.common.collect.Maps;

public class Main {
    public static Map<String, String> getAttributes(Node node) {
        NamedNodeMap map = node.getAttributes();
        Map<String, String> result = Maps.newHashMap();
        if (map != null) {
            for (int i = 0; i < map.getLength(); i++) {
                result.put(map.item(i).getNodeName(), map.item(i).getNodeValue());
            }// www .j  av  a 2 s .  c  om
        }
        return result;
    }
}

Related

  1. getAttributes(Node node)
  2. getAttributes(Node node)
  3. getAttributes(Node node)
  4. getAttributes(Node node)
  5. getAttributes(Node node)
  6. getAttributes(Node node)
  7. getAttributes(String element, String xsd)
  8. getAttributes(XMLEvent evt)
  9. getAttributesAsMap(Element e)