Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Node;

public class Main {
    public static boolean getBoolean(Node aNode, String attr, boolean defaultValue) {
        if (aNode.getAttributes().getNamedItem(attr) != null) {
            String docText = aNode.getAttributes().getNamedItem(attr).getNodeValue();
            if (docText.toLowerCase().equals("true")) {
                return true;
            }
            if (docText.toLowerCase().equals("false")) {
                return false;
            }
            System.out.println("strange boolean value '" + docText + "'");
            return defaultValue;
        } else {
            return defaultValue;
        }
    }
}