Brian Gibson wrote:

This might sound like a dumb question but.... does anyone know of a module or script that simply checks an XML file to see if it is well-formed or not (the validity of the XML is not an issue, but if there is an easy way to check that too then I am all for it!)

My search around CPAN got pretty frustrating.




You can use XML::Parser to do a simple well-formedness check, like this:

   require XML::Parser;
   my $p1 = new XML::Parser(ErrorContext => 3);
   eval{$p1->parse($xml)}; # assume document in $xml
   print "Not well formed!\n$@" if $@; # fatal error

HTH

--

Alan F. Dickey - Interaction and Realization
http://www.intac.com/~afdickey
mailto:[EMAIL PROTECTED]
VOX: 908-273-3232 Cell: 908-334-0932


_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to