Gets the XML nodes from the list with said name. - Android XML

Android examples for XML:XML Node

Description

Gets the XML nodes from the list with said name.

Demo Code


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

public class Main {
    /**//from  w w w .  ja va 2  s  .  c  o  m
     * Gets the nodes from the list with said name.
     * @param doc      The xml document to read from.
     * @param nodeName   The name of the tag.
     * @return         The NodeList for said tag.
     */
    public static NodeList getNodesByName(Document doc, String nodeName) {
        Element docEle = doc.getDocumentElement();
        NodeList list = docEle.getElementsByTagName(nodeName);
        return list;
    }
}

Related Tutorials