@hackage xml-prettify-text1.0.0.2

XML pretty printer

xml-prettify-text

XML pretty printer based on xml-prettify by David M. Rosenberg. Modified to work with Text instead of String and tuned for improved performance.

Build status Hackage Stackage Lts Stackage Nightly GPL-2.0-only license

Usage

Usage: xml-prettify ((-f|--file FILE_NAME) | (-t|--text XML_TEXT))
                    [(-o|--out FILE_NAME) | (-c|--console)]
                    [--indent-style <TAB | SPACE SIZE>] [--eol <LF | CR | CRLF>]
  Pretty-prints XML text

Available options:
  -f,--file FILE_NAME      XML file to pretty-print
  -t,--text XML_TEXT       XML text to pretty-print
  -o,--out FILE_NAME       XML file to pretty-print to
  -c,--console             Output the pretty-printed XML to the console
  --indent-style <TAB | SPACE SIZE>
                           The indent style (TAB or SPACE
                           INDENT_SIZE) (default: SPACE 2)
  --eol <LF | CR | CRLF>   The line-break style: Line Feed (LF), Carriage Return
                           (CR), or both (CRLF) (default: LF)
  -h,--help                Show this help text

Motivation

Why re-implement xml-prettify?

  • I am not satisfied with the Text.PrettyPrint output.
  • xml-prettify produces good output, but with poor performance.
  • xml-prettify appears not to be maintained (I haven't been able to use it as a library in modern projects).
  • Some more configurability (see TODOs) would be great.
  • A good project for me to practise profiling and benchmarking in Haskell.

TODO

  • Port xml-prettify for use with Text
  • Refactor for better readability
  • Implement golden tests
  • Profile, benchmark & squeeze performance
  • Add options for specifying newlines, indent-style, indent-size, etc.
  • Create cli app