01: package org.objectweb.celtix.helpers;
02:
03: import org.w3c.dom.Node;
04:
05: public final class NodeUtils {
06:
07: private NodeUtils() {
08: //Complete
09: }
10:
11: /**
12: * Returns a first child DOM Node of type ELEMENT_NODE
13: * for the specified Node.
14: */
15: public static Node getChildElementNode(Node xmlNode) {
16: if (xmlNode == null || !xmlNode.hasChildNodes()) {
17: return null;
18: }
19:
20: xmlNode = xmlNode.getFirstChild();
21: while (xmlNode != null
22: && xmlNode.getNodeType() != Node.ELEMENT_NODE) {
23: xmlNode = xmlNode.getNextSibling();
24: }
25:
26: return xmlNode;
27: }
28: }
|