Search code examples
xmlxmllint

Level of indentation in xmllint


By default xmllint appears to indent by 2 spaces, Is there a way to change the level of indentation on Windows?


Solution

  • I think you need to set the environment variable $XMLLINT_INDENT to be whatever you need (e.g. if you want 4 spaces use four spaces "    "). From the docs:

    $XMLLINT_INDENT environment variable controls the indentation (default value is two spaces " ")

    You then need to run it with the --format flag. e.g.:

    xmllint --format my_file_name.xml