Java tutorial
//package com.java2s; import java.util.Vector; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static synchronized Node[] getChildNodes(Node node) { if (node == null) { return null; } Vector childs = new Vector(); for (Node n = node.getFirstChild(); n != null; n = n.getNextSibling()) { childs.add((Element) n); } Node[] childNodes = new Element[childs.size()]; childs.toArray(childNodes); return childNodes; } }