xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud Le Hors <leh...@us.ibm.com>
Subject Re: Traversing a DOM by name
Date Tue, 09 Jan 2001 22:47:36 GMT
The DOM doesn't provide with any built-in method to do that because it
only takes a few lines to do it:

Node getFirstChildByName(Node n, String childName) {
   for (Node child = n.getFirstChild(); child != null; child =
child.getNextSibling()) {
      if (childName.equals(child.getNodeName())) {
          return child;
      }
   }
   return null;
} 
-- 
Arnaud  Le Hors - IBM Cupertino, XML Strategy Group

Mime
View raw message