ksconf xml-format¶
Normalize and apply consistent XML indentation and CDATA usage for XML dashboards and navigation files.
Technically this could be used on any XML file, but certain element names specific to Splunk’s simple XML dashboards are handled specially, and therefore could result in unusable results.
The expected indentation level is guessed based on the first element indentation, but can be explicitly set if not detectable.
usage: ksconf xml-format [-h] [--indent INDENT] [--quiet] FILE [FILE ...]
Positional Arguments¶
FILE | One or more XML files to check. If ‘-‘ is given, then a list of files is read from standard input |
Named Arguments¶
--indent | Number of spaces. This is only used if indentation cannot be guessed from the existing file. |
--quiet, -q | Reduce the volume of output. |
See also
Pre-commit hooks
See Pre-commit hooks for more information about how the xml-format
command can be
integrated in your git workflow.
NOTE: While it may work on other XML files, it hasn’t been tested for other files, and therefore is not recommended as a general-purpose XML formatter. Specific awareness of various Simple XML tags is baked into this product.
Note
This command requires the external lxml
Python module
This package was specifically selected (over the built-in ‘xml.etree’ interface) because it
(1) support round-trip preservation of CDATA blocks, and
(2) it is already ships with Splunk’s embedded Python.
This is an optional requirement, unless you want to use the xml-format
command.
However, due to packaging limitations and pre-commit hook support, install the python package will attempt to install lxml as well.
Please reach out if this is causing issues for you; I’m looking into other options too.