I am doing yahoo API program where i am getting result as XML format and fetching values from that xml files using the rule name. But in my case the xml file looks like this.
<person>
<first>Kiran</first>
<first>sam</first>
<url>www.aaaaaaaaddd.com</url>
<last>Pai</last>
<age>22</age>
<url>www.ajsajha.com</url?
</person>
<person>
<first>Kiran</first>
<first>tom</first>
<url>www.aaaaasdadd.com</url>
<last>Pai</last>
<age>22</age>
<url>www.wqeqwjha.com</url>
</person>
In this i want to take values from the following rules : first, url, lat, age. But i want to take only one value from the rule first, url.
if(e.getElementsByTag("url")!=null)
{
itemStringBuilder.append(e.getElementsByTag("url").text());
}
when i use this code i am getting both the url values. How can i check and avoid the second one and just take the first.