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 org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

import com.google.gson.JsonObject;

public class Main {
    private static void traverseAttributes(JsonObject childJson, Node childNode) {
        NamedNodeMap attrNodeMap = childNode.getAttributes();
        for (int j = 0; j < attrNodeMap.getLength(); j++) {
            Node attrNode = attrNodeMap.item(j);
            childJson.addProperty("-" + attrNode.getNodeName(), attrNode.getNodeValue());
        }
    }
}