Building a tree from a HTML report with DOM?

C

Craig

I have a 3rd party product that output reports to html.

It's quite old now and doesn't output some reports correctly.

We have a report that should show a structure like this:

Europe
France
Paris
UK
London
Germany
Munich
Spain
Madrid
Americas
USA
New York
Canada
Toronto
APAC
Australia
Canberra
NZ
Auckland

The trouble is that it doesn't!

The html output is like so (I've snipped it to save on space).

<table>
<tr>
<td>Europe</td>
</tr>
<tr>
<td> France</td>
</tr>
<tr>
<td> Paris</td>
</tr>
<tr>
<td> UK</td>
</tr>
<tr>
<td> London</td>
</tr>
etc etc etc

I take it because the "spaces" aren't &nbsp; it doesn't show
correctly.

Ideally I'd like to do something clever and make it a expandable tree
so users can expand the company structure as they wish.

Is this a possibility with DOM?

Thanks in advance!
 
M

Michael Winter

[snip]
I take it because the "spaces" aren't &nbsp; it doesn't show correctly.

Yes, but the output should be changed entirely. The data is obviously a
set of nested lists.

[snip]
Is this a possibility with DOM?

I don't believe so. The spaces will be collapsed and as this is the only
form of structure to the data (unless you're abridging the mark-up), there
will be no way to determine which "level" the table data actually belongs
to. You'll have to preprocess the output directly or change to a competent
program.

Mike
 
E

Evertjan.

Craig wrote on 14 dec 2004 in comp.lang.javascript:
Europe
France
Paris
UK
London

Use css classes:

<style>
..continent {padding-left:0;}
..country {padding-left:20px;}
..capital {padding-left:40px;}
</style>

<table>
<tr><td class=continent>Europe</td></tr>
<tr><td class=country>France</td></tr>
<tr><td class=capital>Paris</td></tr>
<tr><td class=country>Britain</td></tr>
<tr><td class=capital>London</td></tr>
....
 
C

cmc_dermo

Evertjan. said:
Craig wrote on 14 dec 2004 in comp.lang.javascript:

Use css classes:

<style>
.continent {padding-left:0;}
.country {padding-left:20px;}
.capital {padding-left:40px;}
</style>

<table>
<tr><td class=continent>Europe</td></tr>
<tr><td class=country>France</td></tr>
<tr><td class=capital>Paris</td></tr>
<tr><td class=country>Britain</td></tr>
<tr><td class=capital>London</td></tr>
...
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top