xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SGSWeb <sgs...@websulting.com>
Subject Restrict getElementsByTagName to Top Level
Date Thu, 06 Aug 2009 21:55:42 GMT
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.


Mime
View raw message