Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import org.w3c.dom.Element;

public class Main {
    /**
     * Fetches text from a element
     * 
     * @param parent
     *            the parent of the element you want to fetch text from
     * @param tagName
     *            name of the element you want to fetch text from
     * @return text of tag
     */
    public static String getText(Element parent, String tagName) {
        return parent.getElementsByTagName(tagName).item(0).getTextContent();
    }
}