Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * @(#)XMLUtils.java   1.6 05/11/17
 *
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

import java.util.Properties;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class Main {
    private static Properties importProperties(NodeList nodeList) {
        Properties properties = new Properties();
        for (int i = 0; i < nodeList.getLength(); i++) {
            Element entry = (Element) nodeList.item(i);
            if (entry.hasAttribute("name")) {
                String val = (entry == null) ? "" : entry.getFirstChild().getNodeValue();
                String key = entry.getAttribute("name");
                properties.setProperty(key, val);
            }
        }
        return properties;
    }
}