Search code examples
javasolrformattingpretty-print

Java APIs or Web services to format (or beautify) the html, xml, .java files


Are there any Java APIs (or web services) to beautify/format/pretty-print the html, xml and .java source code files?

So basically, I m indexing these various types of files in Apache Solr server and then fetching it when user searches for it. I m using Solr Cell for this. (Its like a grepcode application.)

The problem here is the file content comes as a plain text w/o any formatting (as the Solr field type is 'text' in the schema).

I m looking for any APIs (in Java) or web services so that I can hook it up in my application and convert the text (String in Java) to well formatted output to show on a web page.

Appreciate the pointers.

Thanks!


Solution

  • I got the solution html and tag is doing the trick.
    All I wanted was to preserve the whitespaces while displaying the content (string).

    Thanks.