Search code examples
javalynx

Java HTML normalizer?


IS there a library which can transform any given HTML page with JS, CSS all over it, into a minimalistic uniform format?

For instance, if we render stackoverflow homepage, I want it to be shown in a minimal format. I want all other sites to be rendered down.

Sort of like Lynx web browser but with minimal graphics.


Solution

  • To answer your firtst question: No. I don'nt think there is a library for that purpose. (At least this is what my "googeling" resulted in).

    And i think the reason for this is, that what you want is a very special need.

    So as a solution for your problem you can parse the html and display it the way you want to in a JEditorpane or whatever you are using for display.

    I can only suggest a way i would do it (this is because i am familiar with xml and everything around it).

    or

    • use xslt to transform the document into some other html document which results in a view that fits your needs.

    or

    • use one of the available html parser librarys. (The most of which i found where kind of outdated (2006)) but they could be an option for you.

    This is just one suggestion how you could do it. I'm sure there are thousands of other ways which will do the same thing.