Java XML NodeList GetFirstInstance(NodeList nList)

Here you can find the source of GetFirstInstance(NodeList nList)

Description

Get First Instance

License

Open Source License

Declaration

public static String GetFirstInstance(NodeList nList) 

Method Source Code

//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("");
    }/*w  w  w  .j av  a2 s.  c om*/
}

Related

  1. getEnvVariableMap(NodeList nodes)
  2. getFirst(NodeList nodes)
  3. getFirstElement(NodeList list)
  4. getFirstElement(NodeList list)
  5. getFirstElement(NodeList nodes)
  6. getFirstNode(NodeList nodeList)
  7. getFirstNodeValue(NodeList nodeList)
  8. getFirstTextValueFromNodeList(NodeList nList)
  9. getFirstValue(NodeList nodes)