hi,
i tried to delete an element in xml..for that i used servlet coding...it is getting deleted but blank spaces are remaining i dont want that blank spaces..can any one do me needfull..here is my code.. its urgent
thanks in advance,
madhu.
i tried to delete an element in xml..for that i used servlet coding...it is getting deleted but blank spaces are remaining i dont want that blank spaces..can any one do me needfull..here is my code.. its urgent
Code:
private void delNode(java.io.File file, Document parent, String filtervalue)
throws Exception
{
NodeList nodeList = parent.getElementsByTagName("PACK_NAME");
for (int i = 0; i < nodeList.getLength(); i++) {
Node child = nodeList.item(i);
System.out.println("child " + child.getTextContent());
if (child.getTextContent() != null && child.getTextContent().trim().equalsIgnoreCase(filtervalue.trim())) {
Node packNode = child.getParentNode().getParentNode();
Node packsNode = parent.getFirstChild();
packsNode.removeChild(packNode);
break;
}
}
}
madhu.
Comment