xml question
Ajay
abra9823 at mail.usyd.edu.au
Sat Aug 14 09:06:01 EDT 2004
hi!
i am trying to remove all whitespace elements out of a document.
my code is below
def stripWhiteSpaces(doc):
whiteSpaces = xpath.Evaluate("//text()", doc.documentElement)
counter=0
while(counter< len(whiteSpaces)):
str = whiteSpaces[counter].nodeValue
string.strip(str)
if len(str) == 0:
whiteSpaces[counter].parentNode.removeChild(whiteSpaces[counter])
counter += 1
return doc
however this isn't working. when i print out all the elements in the
document, i still get the whitespace text elements.
what am i doing wrong?
thanks
cheers
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the Python-list
mailing list