-3

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.

Community
  • 1
  • 1
Ashish
  • 1,121
  • 2
  • 15
  • 25
  • XML doesn't have to "understand" HTML elements. If the document is well formed, you can parse it and it will give you what is inside your doucment. You do not state clearly what is your question. – Ludovic Kuty Oct 25 '13 at 10:05

1 Answers1

1

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

Community
  • 1
  • 1
yarl
  • 3,107
  • 1
  • 22
  • 28
  • Thanx for your response. Do you really want me to use HTML Parsing within XML parsing. I thought of using JAXB but it requires your xml to have a standard format. In my case the element tags inside my xml are dynamic. Looks like Apache Camel is my last option to try – Ashish Oct 18 '13 at 15:25