You seem to be wanting to check that an XML document is 'well formed'. Here's a Perl one-liner that will do that:
perl -MXML::Parser -e "XML::Parser->new( ErrorContext => 3 )->parsefil +e(shift)" your_file.xml
If you were incorporating it into a larger script, then you'd want to wrap it in eval { ... } and check the contents of $@ afterwards.
One trap with using XML::Simple for well-formedness checks is that the SAX parser included in the latest release of XML::LibXML does not die on all parse errors.
In reply to Re: How can i validate xml file?
by grantm
in thread How can i validate xml file?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |