Java XML Element Get getElements(Element root, String element)

Here you can find the source of getElements(Element root, String element)

Description

get Elements

License

Open Source License

Declaration

public static List<Element> getElements(Element root, String element) 

Method Source Code


//package com.java2s;
import java.util.*;

import org.w3c.dom.*;

public class Main {
    public static List<Element> getElements(Element root, String element) {
        NodeList list = root.getElementsByTagName(element);
        List<Element> ret = new ArrayList<>(list.getLength());

        for (int i = 0; i < list.getLength(); i++) {
            ret.add((Element) list.item(i));
        }//from   w  w  w .j a va2  s .  co m

        return ret;
    }
}

Related

  1. getElements(Element elem, String path)
  2. getElements(Element element)
  3. getElements(Element element, String tagName)
  4. getElements(Element node)
  5. getElements(Element root)
  6. getElements(Element root, String tagName)
  7. getElements(Element topElm)
  8. getElements(final String elementName, final InputStream is, final boolean onlyValues)
  9. getElementsByName(Element elem, String s)