Here you can find the source of getElements(Element node)
Parameter | Description |
---|---|
node | The parent node element. |
public static ArrayList<Element> getElements(Element node)
//package com.java2s; /***************************************************************************** * Web3d Consortium Copyright (c) 2007 - 2008 * Java Source * * This source is licensed under the GNU LGPL v2.1 * Please read http://www.gnu.org/copyleft/lgpl.html for more information * * This software comes with the standard NO WARRANTY disclaimer for any * purpose. Use it at your own risk. If there's a problem you get to fix it. * *****************************************************************************/ import java.util.ArrayList; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /**/*ww w . ja v a2 s. c o m*/ * Search the children of the argument node for elements. * * @param node The parent node element. * @return The list of elements. */ public static ArrayList<Element> getElements(Element node) { ArrayList<Element> list = new ArrayList<Element>(); // note that we need to preserve the order of the child elements, // transformational elements of a Collada node must be processed // in order. NodeList nl = node.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i); if (n.getNodeType() == Node.ELEMENT_NODE) { Element e = (Element) n; list.add(e); } } return (list); } }