KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > helpers > NodeUtils


1 package org.objectweb.celtix.helpers;
2
3 import org.w3c.dom.Node JavaDoc;
4
5 public final class NodeUtils {
6
7     private NodeUtils() {
8         //Complete
9
}
10
11     /**
12      * Returns a first child DOM Node of type ELEMENT_NODE
13      * for the specified Node.
14      */

15     public static Node JavaDoc getChildElementNode(Node JavaDoc 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 }
29
30
Popular Tags