User Tools

Site Tools


technology:linux:xml_file_validation

XML File Validation

I wanted a quick-and-easy way to validate all the XML documents in one of my java projects. I found xmllint which is a great program. But I needed it to do a little more. Fortunately, its easy to wrap it in a shell script and make it do exactly what I want.

#! /bin/bash
# Chris Freyer
# Sept 10, 2009
 
for f in `find . -name "*.xml"`; do
        xmllint --nowarning --noout --valid $f
        rc=$?
        if [ $rc -gt 0 ]; then
                echo RC on $f was $rc
        fi
done
/home/cfreyer/public_html/data/pages/technology/linux/xml_file_validation.txt · Last modified: 2010/08/30 17:34 by Chris Freyer