Java based HTML parser that outputs a formatted text string?

Discussion in 'Java' started by Harry Bosch, Aug 3, 2005.

  1. Harry Bosch

    Harry Bosch Guest

    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
     
    Harry Bosch, Aug 3, 2005
    #1
    1. Advertising

  2. Harry Bosch wrote:
    >
    > 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]?

    --
    Unemployed English Java programmer
    http://jroller.com/page/tackline/
     
    Thomas Hawtin, Aug 3, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Henry

    HTML Optimization for asp.net outputs

    Brian Henry, Oct 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    748
    Steven Cheng[MSFT]
    Oct 6, 2004
  2. Replies:
    3
    Views:
    422
  3. Mike
    Replies:
    1
    Views:
    103
    Thomas 'PointedEars' Lahn
    Aug 21, 2004
  4. jean-gert nesselbosch

    standardization efforts concerning xml-parser-outputs

    jean-gert nesselbosch, Oct 20, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    102
  5. Replies:
    4
    Views:
    108
    Dr John Stockton
    Jun 27, 2005
Loading...

Share This Page