开发者

Preserve line breaks in strings parsed from XML

开发者 https://www.devze.com 2023-03-23 06:46 出处:网络
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 ale

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消