Free XML formatter (indent) tool on Mac? [closed]
Need a tool that can format the xml in human readable format on Mac!
I use TextWrangler (free) together with a text filter which uses xmllint. Download it here: http://www.barebones.com/products/textwrangler/download.html
After you have it, create a new file and save it with a name like tidy.sh under ~/Library/Application Support/TextWrangler/Text Filters
. Write the following in the file and save it:
#!/bin/sh
XMLLINT_INDENT=$'\t' xmllint --format --encode utf-8 -
The above should also work for BBEdit 11. For versions of TextWrangler < 4.0 or BBEdit < 11, this script should be slightly different:
#!/bin/sh
xmllint "$*" | XMLLINT_INDENT=$'\t' xmllint --format --encode utf-8 -
Then you'll be able to apply this from the Text menu > Apply Text Filter > tidy To make it even easier, you can bind a shortcut to this. Go to Window > Palettes > Text Filters. You will see your tidy filter there. Select and hit "Set Key..." and choose a combination that suits you (I use alt+cmd+x).
I suggest you install XMLLint which the best solution to view pretty formatted XML (included in LibXML package.
Just started today to use Serna: http://www.serna-xmleditor.com
精彩评论