Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    public static String getDirectTextContent(Node aNode) {
        String result = "";
        NodeList nodeList = aNode.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node aSubNode = nodeList.item(i);
            if (aSubNode.getNodeType() == Node.TEXT_NODE) {
                result += aSubNode.getNodeValue();
            }
        }
        return result;
    }
}