I have an XML file as follows:

|<rootNode>
   <link>http://rootlink/</link>
   <image>
       <link>http://imagelink/</link>
       <title>This is the title</title>
   </image>
</rootNode>
|

The XML Java code using DOM is as follows:

|NodeList rootNodeList = element.getElementsByTagName("link");
|

This will give me all of the "link" elements including the top level and the one inside the "image" node.

Is there a way to just get the "link" tags for rootNode within one level and not two such as is the case for the image link? That is, I just want the http://rootlink/ "link".

thanks,
sgs.

Reply via email to