Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**************************************************************************************
 * Copyright (C) 2012 Lisa park, Inc. All rights reserved. 
 * http://www.lisa-park.com                           *
 * E-Mail: alexmy@lisa-park.com                                                       *
 * ---------------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the GPL license       *
 * a copy of which has been included with this distribution in the license.txt file.  *
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt                               *
 **************************************************************************************/

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    private static Boolean qtyProductionConditions(Node node) {
        return node.getNodeName().equalsIgnoreCase("RAW_MATERIAL")
                || node.getNodeName().equalsIgnoreCase("TOTAL_MATERIALS")
                || node.getNodeName().equalsIgnoreCase("TOTAL_PRODUCTS");
    }

    private static String getNodeName(Node node) {
        String name = "";
        NodeList nodeList = node.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node curNode = nodeList.item(i);
            if ("name".equalsIgnoreCase(curNode.getNodeName())) {
                name = curNode.getTextContent().replace("\"", "");
                break;
            }
        }

        return name;
    }
}