Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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