Preserve Newlines When Parsing Xml
I'm using the SAX xml parser to parse some xml data which contains newlines. When using Attributes#getValue, the newline data is lost. How can keep the newlines?
Solution 1:
you can use this code when getting the String to parse:
public void characters(char ch[], int start, int length) {
for(int i=start; i<length; i++)
if(!Character.isISOControl(ch[i]))
content.append(ch[i]);
}
Solution 2:
The solution was to use 

instead of \n
Post a Comment for "Preserve Newlines When Parsing Xml"