normalize a <table> with multiple, variable, data in each <td>

O

okey

I have to believe this has been done many time before.

We have a well formed html <table> which contains X rows with Y
columns in each. Nice and regular...

Each <td> however contains mutliple chunks of data. Data in these
cells is delimited by a <br />
but could be anything I guess.

We need to take this table and regenerate it so that each data chunk
has it's own row.

For example

<table>
<tr>
<td>item01</td>
<td>item<br />item< br/>item</td>
</tr>

<tr>
<td>item03<br/></td>
<td>item<br /></td>
</tr>

would result in

<table>
<tr>
<td>item01</td>
<td>item</td>
</tr>
<tr>
<td>item01</td>
<td>item</td>
</tr>
<td>item01</td>
<td>item</td>
</tr>
<tr>
<td>item03 .....

.... and so on.

We could code this. but this has to be some kind of module (with
normal good module stuff). Is there something out there
 
J

Jim Gibson

okey said:
I have to believe this has been done many time before.

We have a well formed html <table> which contains X rows with Y
columns in each. Nice and regular...

Each <td> however contains mutliple chunks of data. Data in these
cells is delimited by a <br />
but could be anything I guess.

We need to take this table and regenerate it so that each data chunk
has it's own row.

For example

<table> ......

... and so on.

We could code this. but this has to be some kind of module (with
normal good module stuff). Is there something out there

There is the HTML::TableExtractor module, which will help you with
extracting the table info. Reformatting is then up to you. Breaking out
rows in an HTML table seems a little too specialized to have a module
already written, but who knows?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top