Here you can find the source of getChildElements(Node parent)
public static List getChildElements(Node parent)
//package com.java2s; /*//from ww w .j a v a 2 s . c o m * ==================================================================== * This software is subject to the terms of the Common Public License * Agreement, available at the following URL: * http://www.opensource.org/licenses/cpl.html . * Copyright (C) 2003-2004 TONBELLER AG. * All Rights Reserved. * You must accept the terms of that agreement to use this software. * ==================================================================== * * */ import java.util.ArrayList; import java.util.List; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /** * returns List of all direct child elements */ public static List getChildElements(Node parent) { ArrayList retVec = new ArrayList(); NodeList children = parent.getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { if (children.item(i).getNodeType() == Node.ELEMENT_NODE) { retVec.add(children.item(i)); } } return retVec; } }