/******************************************************************************* | |
* Copyright (c) 2012 The University of York. | |
* This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License 2.0 | |
* which is available at https://www.eclipse.org/legal/epl-2.0/ | |
* | |
* Contributors: | |
* Dimitrios Kolovos - initial API and implementation | |
******************************************************************************/ | |
package org.eclipse.epsilon.emc.plainxml; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.w3c.dom.Element; | |
import org.w3c.dom.NodeList; | |
public class DomUtil { | |
public static List<Element> getChildren(Element parent) { | |
List<Element> result = new ArrayList<>(); | |
NodeList childNodes = parent.getChildNodes(); | |
for (int i=0; i<childNodes.getLength(); i++) { | |
Object o = childNodes.item(i); | |
if (o instanceof Element) { | |
result.add((Element) o); | |
} | |
} | |
return result; | |
} | |
} |