Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.DOMException;
import org.w3c.dom.Node;

public class Main {
    public static String getChildValue(Node node) throws DOMException {
        Node child = node.getFirstChild();
        if (child != null) {
            String val = child.getNodeValue();
            if (val.toUpperCase().startsWith("[CDATA")) {
                val = val.substring(7, val.length() - 2);
            }
            return val;
        } else
            return "NULL";
    }
}