Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I run:

#!/bin/sh
xmllint --c14n "$*" | XMLLINT_INDENT=$'\t' xmllint --encode UTF-8 --format -

I get

/private/var/folders/Aj/Aj9m3c8JGnmkccHY2o3lKE+++TI/Cleanup At Startup/Tidy XML.sh.S:1: parser error : Start tag expected, '<' not found question_autoSwitch ^ -:1: parser error : Document is empty

^ -:1: parser error : Start tag expected, '<' not found

Something is very wrong. :P

Any ideas?

share|improve this question
    
I don't know anything, but that hat pipe | looks out of place. did you mean to have another command after it or did you mean to escape it? –  Zoredache Mar 18 '11 at 23:06
    
This is where I go the script magp.ie/2010/02/15/format-xml-with-textwrangler –  bobber205 Mar 18 '11 at 23:20

1 Answer 1

Try this instead:

#!/bin/bash
XMLLINT_INDENT=$'\t' xmllint --encode UTF-8 --format - $*
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.