Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: XML validating (no DTD)

by 2ge (Scribe)
on Sep 02, 2004 at 21:33 UTC ( [id://388124] : note . print w/replies, xml ) Need Help??


in reply to Re: XML validating (no DTD)
in thread XML validating (no DTD)

Hi

I just found the solution on perlmonks, it is so easy:
use XML::Parser; my $p = XML::Parser->new; my $file = 'data.xml'; eval { $p->parsefile($file) }; if ($@) { print 'XML is not well formed'; } else { print 'XML is well formed'; }


Ofcoure, I can't validate XML, if I don't have DTD, I can check it if it is well formed, sorry for mistake.