Node el = node.getFirstChild();
while (el != null) {
Node next = el.getNextSibling();
if (el.getNodeType() == Node.TEXT_NODE) {
String str = el.getNodeValue().trim();
if (str.equals("")) {
node.removeChild(el);
}
} else {
if (el.getNodeType() == Node.ELEMENT_NODE) {
removeEmptyTextNodes((Element)el);
}
}
el = next;
}
}
-----Original Message-----
From: Harikrishna_B [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 13, 2002 8:35 AM
To: [EMAIL PROTECTED]
Subject: How To remove WhiteSpaceHello All,
I constructed a Dom from an xml file.
I had counted the number of children for the rootnode.
I am getting #text elements are also the children of root node.
How to remove this #text?
This empty element is coming between one element and the other element.
Thanks in Advance,
B.HARIKRISHNA
**************************************************************************
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.**************************************************************************
