in reply to Validating XHTML
Hi try this,
If you need to check whether the xml content is correct or not you can use this below code. If you need to parse the file just call the method parse_file method. If there is error found in xml file it print and check in $@, you can see the error
use XML::LibXML; my $xml_string = "<test>Teststring</test>"; my $parser = XML::LibXML->new; eval { $parser->parse_string($xml_string) }; print "it's not a valid xml" if ($@) ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Validating XHTML
by Anonymous Monk on Apr 28, 2006 at 13:32 UTC | |
by davorg (Chancellor) on Apr 28, 2006 at 13:49 UTC | |
by dorward (Curate) on Apr 28, 2006 at 14:33 UTC |