XML: tools for reindexing XML in batch mode

I have a lot of badly indented XML files.

I want to write a script or use a tool that discards all files.

Is there such a tool or a good library in the main scripting language (Ruby and Python are preferred) or in Java?

+3
source share
3 answers

You are looking for an XML pretty printer .

Here is an online tool that uses xmlpp under the hood.

+1
source

Here is a long list of options:

http://www.dpawson.co.uk/xsl/sect2/pretty.html#d8578e19

, , xslt HTML Tidy.

+1

If you want the package to disable them yourself, and you are using Linux, use the following script. It will create copies of the source files added with the _ symbol:

for i in *.xml; do xmllint --format "$i" > pretty_"$i"; done
0
source

Source: https://habr.com/ru/post/1731396/


All Articles