Reputation: 643
I am parsing a xml document which contains
<items>
<item> a </item>
<item> b </item>
.....
<item> z </item>
</items>
I am able to get the items tag by
document.getElementsByTag("items");
but the problem is i couldn't get all the item tag in to a NodeList please help ... Thanks in advance..
Upvotes: 1
Views: 1038
Reputation: 11
than apply a loop
Node nodelist = Document.getElementbyTag("parent tab");
for(int i=0;i<nodelist.getlength();i++)
{
Node node = nodeList.item(i);
Element fstElmnt = (Element) node;
NodeList SidList = fstElmnt.getElementsByTagName("sid");//the chils tags
Element sidElement = (Element) SidList.item(0);
SidList = sidElement.getChildNodes();
String nameValue = ((Node) SidList.item(0)).getNodeValue();
Log.e("Serial_id",nameValue);
}
Upvotes: 1