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 String getString(Node aNode, String attr) {
        return getString(aNode, attr, null);
    }

    public static String getString(Node aNode, String attr, String aDefault) {
        if (aNode.getAttributes().getNamedItem(attr) != null) {
            String docText = aNode.getAttributes().getNamedItem(attr).getNodeValue();
            return docText;
        } else {
            return aDefault;
        }
    }
}