[英]How to read html on java without jsoup or any other third party?
I have a StringBuilder object in my class which I want to display on UI.我的 class 中有一个 StringBuilder object,我想在 UI 上显示它。 This object has few html tags for ex:
<li> <br>
etc. I would like to know how to format this object so that the html tags are not shown as it is on screen, however they are converted to a readable format. This object has few html tags for ex:
<li> <br>
etc. I would like to know how to format this object so that the html tags are not shown as it is on screen, however they are converted to a readable format.
Note: I don't want to remove these tags and get a plain text.注意:我不想删除这些标签并获得纯文本。 Rather if there is a
<br>
tag it should break line while displaying the text.相反,如果有一个
<br>
标签,它应该在显示文本时换行。 Also, due to project restrictions I don't want to use any third party like jsoup etc.另外,由于项目限制,我不想使用任何第三方,如 jsoup 等。
Any help to achieve this would be appreciated!任何帮助实现这一目标将不胜感激!
How about simple .toString().replaceAll
with specific replacements?带有特定替换的简单
.toString().replaceAll
怎么样? Like:喜欢:
<br>
= \r\n <br>
= \r\n
<li>
= \r\n • <li>
= \r\n •
...and so on.. ...等等..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.