Here you can find the source of getChildElements(NodeList list)
public static List<Element> getChildElements(NodeList list)
//package com.java2s; /**//from w ww. j av a2 s . c om * Copyright (c) 2015 Genuitec LLC. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Piotr Tomiak <piotr@genuitec.com> - initial API and implementation */ import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static List<Element> getChildElements(NodeList list) { List<Element> result = new ArrayList<Element>(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); if (node instanceof Element) { Element el = (Element) node; result.add(el); } } return result; } }