Skip to main content
Inspiring
December 21, 2011
Answered

How to transform/parse an html table

  • December 21, 2011
  • 1 reply
  • 3226 views

Hi

I have a string containing the code of an html table...

<table>

<tr>

<td>Column 1</td>

<td>Column 2</td>

<td>Column 3</td>

</tr>

<tr>

<td>Row1Value1</td>

<td>Row1Value2</td>

<td>Row1Value3</td>

</tr>

... etc. ...

</table>

Actually I would like to have the content of the table in a query (would prefer this) or in a xml structure or in a cf structure or in an array or whatever. I tried to do this with XMLParse but I did not get it - I do not want to understand DTDs or what ever it needs.

Is there a simple way for a rookie as me?

Thank you very much!

This topic has been closed for replies.
Correct answer Dan_Bracuk

Meanwhile I even managed to remove all tabs, carriage returns and line feeds. My string looks now like this:

fuehren;4;2.92|meglich;2;1.72|werden;2;1.23|diese;1;4.56|


From here all you need to do to get the 3 values of word;number,number is to treat the string as a | delimited list.

1 reply

Inspiring
December 21, 2011

Where are the values (Row1Value1 for example) coming from now?

Inspiring
December 21, 2011

Hello Dan

I'm parsing with cfhttp an external webpage and then I'm stripping the code at a point where I got the discussed html table left. I'm not sure whether this idea works to the end but I thought this would be at least a nice start.

Nice to read from you! I hope you can help me out (what you didi already severla times in the past - many thanks for this).

Inspiring
December 21, 2011

Once you get this data into a variable type that you like, how do you plan to use it?