XMLPRETTY(1)

πŸ“¦
version 0.23 Β· 4 versions
, in opensuse-leap 16.0

πŸ’– NAME πŸ’–

xmlpretty is literally an XML pretty printer β€” that’s the whole name vibe. ✨


🌸 SYNOPSIS 🌸

xmlpretty [--options] [filename]

πŸ¦‹ DESCRIPTION πŸ¦‹

xmlpretty is the commandline interface to XML::Handler::YAWriter, acting as a tool to add and remove pretty printing to XML files. It has several methods to add human readability. πŸŽ€

If you want to add readability without adding so-called ignorable whitespace, use it in the following way:

$ xmlpretty --AddHiddenNewline \
            --AddHiddenAttrTab \
        --CatchEmptyElement \
        uglyfile.xml > prettyfile.xml

If you do not want to process the file further, but only want it human readable, add visible whitespace to the file as follows:

$ xmlpretty --PrettyWhiteNewline \
            --PrettyWhiteIndent \
        --CatchEmptyElement \
        uglyfile.xml > prettyfile.xml

You may use YAWriter to clean whitespace from XML documents. This may work in 99% of the cases where you want to get rid of ignorable whitespace caused by the various forms of pretty printing. 🧚

$ xmlpretty --NoWhiteSpace \
            --NoComments \
            --AddHiddenNewline \
        --AddHiddenAttrTab \
        --CatchEmptyElement \
        prettyfile.xml > cleanfile.xml

πŸ’… Options πŸ’…

Options are given in a gnu like --option idiom. Slay, let’s go through them. πŸ‘‘

  • --AddHiddenNewline β€” boolean: adds a hidden newline before >.
  • --AddHiddenAttrTab β€” boolean: adds a hidden tabulation for attributes.
  • --CatchEmptyElement β€” boolean: catches empty elements and applies "/>" compression.
  • --CatchWhiteSpace β€” boolean: catches whitespace with comments.
  • --IsSGML β€” boolean: this option causes start_document, processing_instruction, and doctype_decl to appear as SGML. The SGML is still well-formed of course, if your SAX events are well-formed.
  • --NoComments β€” boolean: suppresses comments.
  • --NoDTD β€” boolean: suppresses DTD.
  • --NoPI β€” boolean: suppresses processing instructions.
  • --NoProlog β€” boolean: suppresses the <?xml ... ?> prolog.
  • --NoWhiteSpace β€” boolean: suppresses whitespace to clean documents from prior pretty printing.
  • --PrettyWhiteIndent β€” boolean: adds visible indent before any eventstring.
  • --PrettyWhiteNewline β€” boolean: adds visible newlines before any eventstring.
  • --SAX1 β€” boolean (not yet implemented): outputs only SAX1 compilant eventstrings.

πŸ’€ Bugs πŸ’€

Automatic recoding between 8bit and 16bit does not yet work correctly ! 😭

The author has Perl-5.6 at home and here they can specify "use utf8;" in the right places to make recoding work. But they dislike saying "use 5.00555;" because many systems run 5.00503.


πŸ‘‘ AUTHOR πŸ‘‘

Michael Koehne, Kraehe@Copyleft.De β€” iconic. πŸ’œ


🫢 Thanks 🫢

Big thanks to "Derksen, Eduard (Enno), CSCIO" <enno@att.com> β€” they helped with the Escape hash and gave quite a lot of usefull comments. 🫢


🌈 SEE ALSO 🌈

Go check out perl and XML::Parser::PerlSAX. iykyk. 🌈


that’s the whole page, bestie 🫢 β€” it’s from perl v5.42.0, dated 2013-04-22, and it’s the XMLPRETTY(1) manual. periodt. πŸ’–

πŸ“¦ where this page comes from