Java based HTML parser that outputs a formatted text string?

H

Harry Bosch

Sorry about the subject, I couldn't think of a good one liner.

Does anyone know of an java based html parser that can output its
results to a formatted string (using spaces and such to handle the
layout)?

I am looking for something that can take an HTML table, such as:

<table border="1">
<tr>
<th>Cost</th>
<th>Total</th>
</tr>
<tr>
<td>10</td>
<td>100</td>
</tr>
<tr>
<td>20</td>
<td>200</td>
</tr>
<tr>
<td>30</td>
<td>300</td>
</tr>
</table>

And output it into a string that would look like this when displayed on
a console, text file, or whatever output device:

+--------------+
| Cost | Total |
|------+-------|
| 10 | 100 |
|------+-------|
| 20 | 200 |
|------+-------|
| 30 | 300 |
+--------------+

I guess I am looking for the functionality of something like Links (the
console HTML browser). I want to transform (without using XSLT and
complex transformations) a simple (simple being the key word here) html
file into a formatted text file. And, I really don't feel like
resorting to JNI to fire off Links. I don't need CSS or anything like
that.

Thanks in advance,

Harry Bosch
 
T

Thomas Hawtin

Harry said:
I am looking for something that can take an HTML table, such as:

[...]

And output it into a string that would look like this when displayed on
a console, text file, or whatever output device:

+--------------+
| Cost | Total |
|------+-------|
| 10 | 100 |
|------+-------|
| 20 | 200 |
|------+-------|
| 30 | 300 |
+--------------+

IIRC, Apache FOP can generate monospaced text from XSL FO. But it wasn't
very good and you need to transform your HTML a bit.
file into a formatted text file. And, I really don't feel like
resorting to JNI to fire off Links. I don't need CSS or anything like

Or Process[Builder]?
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top