XML to CSV conversion : Does not understand HTML c

2019-09-21 22:34发布

问题:

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

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>

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).

Does someone know how can I get exact same value in my csv.

Thanks.

回答1:

You should use HTML parser, eg. this one. Also take a look at this question.



标签: java html xml csv sax