I have written a xml parser java program to parse xml files and display. I am using SAX and my java class extends DefaultHandler. In characters() method I get the content of the tag as new String(ch, start, length).
 
The xml files I get to parse with this program includes special characters. They are replaced by appropriated notations ( ie: it replaces & for &) in the server which generates xml files.
 
This is my output:
 
Kandy was the last capital of the Sri Lankan kings which is a World Heritage Site. The name
"
Kandy
"
 conjures visions of splendour and magnificence. Many of the legends, traditions and folklore are s
till lovingly kept alive. Drive around the Kandy Lake built by the last Sinhala king, Sri Wickrama
Rajasinghe in 1798. Visit the Kandy town and Bazaar, the arts
&
 crafts centre, a gem museum and a lapidary. Also visit the Temple of the Tooth Relic in Kandy. The
reafter witness a Cultural show.
 
Please see there are two carriage return (line break) before and after a special character. How do I overcome this issue?
 
Any help will be greatly appreciated.
Best regards,
Ranjith

Reply via email to