XML到CSV转换:不了解HTML字符和其他特殊字符 [英] XML to CSV conversion : Does not understand HTML characters and other special characters
问题描述
我发现此代码可以在java中将任何XML转换为CSV。除了一些例外,代码工作得非常好。这里是代码:
在java中将XML文件转换为CSV
I found this code to convert any XML to CSV in java. the code works really great except with some exceptions. here is the code: Convert XML file to CSV in java
我的xml包含一些特殊字符和html数据。
My xml contains few special characters and html data. an example of one of the tags from my xml is listed below:
<html-rem-string1>
<tr>
<td style="background-color:#f0ebeb;">Feline Rabies Vaccination, 1yr </td>
<td style="font-weight: bold; color:#cc0000; background-color:#f0ebeb;">6/27/2013
</td>
</tr>
</html-rem-string1>
现在每当我尝试转换它时,我都会得到不寻常的结果。
我的理解是它不理解HTML标签和特殊字符(我真的不知道两个不同之处的区别)。
Now whenever I try to convert this, I get unusual results. My understanding is it does not understand HTML tags and special characters (I dont really know the distinction between two sorry).
有人知道我怎么能得到完全相同的价值在我的csv。
Does someone know how can I get exact same value in my csv.
谢谢。
推荐答案
You should use HTML parser, eg. this one. Also take a look at this question.
这篇关于XML到CSV转换:不了解HTML字符和其他特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!