简体   繁体   English

HTML特殊字符解析

[英]HTML speacial character parsing

I'm looking for a java class to parse all HTML special characters. 我正在寻找一个Java类来解析所有HTML特殊字符。 I guess it's a common problem but i cannot find a fast solution right now. 我想这是一个普遍的问题,但是我现在找不到快速的解决方案。

What i wanto to get is: 我想要得到的是:

input: thè --> output: thè
input: »
input: &lraquo;
...

Do you know anything useful for me? 你知道对我有用的吗?

Have you googled on it? 你用谷歌搜索吗? The first link on "java HTML markup entity parser" refers to html text extractor “ java HTML标记实体解析器”上的第一个链接引用html文本提取器

It seems to be what you need. 这似乎是您所需要的。

Also, you may want to examine javax.swing.JLabel's (and another swing text components') renderers. 另外,您可能需要检查javax.swing.JLabel(和另一个swing文本组件)的渲染器。

Try the StringEscapeUtils utility class. 尝试使用StringEscapeUtils实用程序类。 Check the docs for the StringEscapeUtils.unescapeHtml() method. 检查文档中的StringEscapeUtils.unescapeHtml()方法。

Docs here: 此处的文档:

http://commons.apache.org/lang/api-release/org/apache/commons/lang/StringEscapeUtils.html http://commons.apache.org/lang/api-release/org/apache/commons/lang/StringEscapeUtils.html

Download here: 在这里下载:

http://commons.apache.org/lang/ http://commons.apache.org/lang/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM