Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//   Licensed under the Apache License, Version 2.0 (the "License"); you may

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

public class Main {
    public static String GetFirstInstance(NodeList nList) {
        for (int i = 0; i < nList.getLength(); i++) {
            Node nNode = nList.item(i);
            if (nNode.getNodeType() == Node.ELEMENT_NODE) {
                Element eElement = (Element) nNode;
                if (eElement != null)
                    return eElement.getTextContent();
            } // end if nnode.getnodetype()
        } //end for int temp
        return new String("");
    }
}