Preserve line breaks in strings parsed from XML
I have alert dialog that s开发者_开发知识库hows.. alerts. Alerts are parsed from some xml file (using XmlPullParser), and sometimes they have line breaks like "Foo \nbreak". The problem is that alert is being displayed as "Foo \nbreak"
, not like
"Foo
break"
(Needles to say, that if I just put "Foo \nbreak"
directly in dialog - line breaks are displayed properly.)
And I cant even replace that \n
with something useful.. So sad. I suppose, xml "normalizes" all text, or something like this. But what should I do to preserve line breaks?
精彩评论