Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ignoring whitespace when parcing XML

Status
Not open for further replies.

cgillin

Programmer
Mar 20, 2003
58
US
I am trying to parse XML files but would like to ignore all whitespaces. My problem is in my character method of the content handler I have it printing out all text but when it comes to any whitespaces it prints out the blank characters. Anyone know how to correct this?


Thanks a lot,
Chris
 
I forgot to mention that I am using SAX to parse the XML since i'm only interested in printing the text following certain tags.


Chris
 
If you're putting the text into a String, just use trim() before printing it to remove any leading and trailing whitespace.

"When you have eliminated the impossible, whatever remains, however
improbable, must be the truth." ~ Arthur Conan Doyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top