TextWrangler: formatting XML file

Go to directory where TextWrangle keeps all the scripts:

$ cd ~/Library/Application\ Support/TextWrangler/Text\ Filters 

Create a new file for XML formatting:

Text Filters $ touch FormatXML.sh 


This will open the new file in TextWrangler (or whatever editor you have set).
Text Filters $ edit FormatXML.sh 

Enter this text in that file and save:

#!/bin/sh
XMLLINT_INDENT=$'\t' xmllint --format --encode utf-8 -

Now you can format any XML by selecting TextWrangler menu: 

Text > Apply Text Filter > FormatXML


As an Amazon Associate I earn from qualifying purchases.

No comments:

Post a Comment

Post Scriptum

The views in this article are mine and do not reflect those of my employer.
I am preparing to cancel the subscription to the e-mail newsletter that sends my articles.
Follow me on:
X.com (Twitter)
LinkedIn
Google Scholar

Popular Recent Posts

Most Popular Articles

apt quotation..