in reply to Re: Quick check for XML DTD or Schema.. XML::Twig solution
in thread Quick check for XML DTD or Schema
my $t= XML::Twig->new(load_DTD => 1,DTDHandler=>\&checkit )->parsefile +( "$xmlfile"); sub checkit { my ($twig, $dtd) = @_; my $root=$twig->root; my @text=$root->att_names; if (grep /schemaLocation/, @text) { print "found schema\n"; } else { if ($twig->{twig_doctype}) { print "found dtd\n"; } else { print "no dtd/schema defined\n" } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Quick check for XML DTD or Schema.. XML::Twig solution
by Discipulus (Canon) on Nov 07, 2014 at 08:02 UTC |