# ------------------------------------------------------------------------------------------ # Author: Dean Stringer # # Very simple checks to see if an XML file (specified by 1st argument) # is well-formed, ie able to be parsed. If you want to flash this up # alot you'll be better off writing a perl script rather than # extending the following one-liner. # # See the man page for XML::Parser for more detail about parsing options # or to find out how to extend this script. # # ErrorContext is an expat option (XML::Parser extends expat) and specifies # how many lines each side of the line thats not well-formed should be displayed # ------------------------------------------------------------------------------------------ if [ $# -gt 0 ] ; then perl -MXML::Parser -e "XML::Parser->new( ErrorContext => 2)->parsefile(shift)" $1 else echo "Syntax: $0 " fi exit 0