开发者

XML : tools for re-indenting XML in batch mode

I have a whole lot of XML files, badly indented.

I wish to write a script or use a tool which re-indents all the files.

Is there such a tool, or a nice library in a mainstream scripting language (preferred are Ru开发者_运维问答by and Python), or in Java ?


If you want to batch prettify them yourself and you're using Linux, the following script should work. It will create copies of the original files prepended with pretty_:

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


You are looking for an XML pretty printer.

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


Here's a large list of options to do it:

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

The main ones that I'd use are the xslt stylesheet, or HTML Tidy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜