hi
i have written program to remove node of indianplayer with attribute value =9;but its going to the if statement but unable to remove the particular node;whats wrong with the code;i am using DOM parser;
NodeList indianplayers = root.getElementsByTagName("IndianPlayer");
for(int i=0;i<indianplayers.getLength();i++)
{
Element el=(Element) indianplayers.item(i);
String playerid1 =el.getAttribute("PlayerId");
int playeridd=Integer.parseInt(playerid1);
if(playeridd == Integer.parseInt(request.getParameter("playerid")))
{
root.removeChild(indianplayers.item(i));
}
}
<India>
<IndianPlayer PlayerId="1">
<Name>Sachin</Name>
<Age>31</Age>
</IndianPlayer>
<IndianPlayer PlayerId="2">
<Name>Saurav</Name>
<Age>32</Age>
</IndianPlayer>
<IndianPlayer PlayerId="3">
<Name>Yuvraj</Name>
<Age>22</Age>
</IndianPlayer>
<IndianPlayer PlayerId="4">
<Name>Dravid</Name>
<Age>32</Age>
</IndianPlayer>
<IndianPlayer PlayerId="5">
<Name>Kumble</Name>
<Age>34</Age>
</IndianPlayer>
<IndianPlayer PlayerId="6">
<Name>Sehwag</Name>
<Age>24</Age>
</IndianPlayer>
<IndianPlayer PlayerId="7">
<Name>Laxman</Name>
<Age>32</Age>
</IndianPlayer>
<IndianPlayer PlayerId="8">
<Name>parthiv</Name>
<Age>18</Age>
</IndianPlayer>
<IndianPlayer PlayerId="9">
<Name>Zaheerkhan</Name>
<Age>26</Age>
</IndianPlayer>
<IndianPlayer PlayerId="10">
<Name>Balaji</Name>
<Age>26</Age>
</IndianPlayer>
</India>
bye
chaitanya
[ June 18, 2004: Message edited by: kesava chaitanya ]