[PLUG-TALK] Structuring .xml File

Paul Heinlein heinlein at madboa.com
Tue Mar 1 15:12:09 PST 2011

On Tue, 1 Mar 2011, Rich Shepard wrote:

> On Tue, 1 Mar 2011, Dan Young wrote:
>> Tidy can pretty-print XML with something like:
>> tidy -qi -xml /path/to/foo.xml
>   Wow! Works great and is really fast.

I'll note that tidy has a somewhat unusual set of return values, which 
will be of interest if you ever want to use tidy in a shell script:

  0 = success
  1 = there were warnings
  2 = there were errors

Since I can usually live with warnings (but not with errors), I script 
up tidy something like this:

   /usr/bin/tidy [options and files]
   if test $RETVAL -lt 2; then
     exit 0
     exit $RETVAL

Otherwise, warnings (which have a non-zero return value) will cause 
ordinary shell scripts to abort.

Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/

More information about the PLUG-talk mailing list