我正在使用SAX xml解析器解析一些包含换行符的xml数据。使用Attributes#getValue时,换行符数据会丢失。怎样才能保持换行符?
发布于 2010-08-22 06:12:38
解决方案是使用
而不是\n
发布于 2012-12-28 22:47:33
在获取要解析的字符串时,可以使用以下代码:
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]);
} https://stackoverflow.com/questions/3401111
复制相似问题