Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Quick check for XML DTD or Schema.. XML::Twig solution

by ron800 (Novice)
on Nov 06, 2014 at 20:25 UTC ( [id://1106426]=note: print w/replies, xml ) Need Help??


in reply to Re: Quick check for XML DTD or Schema.. XML::Twig solution
in thread Quick check for XML DTD or Schema

Thanks. I think I now can build the solution using XML::Twig
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
    Bravo!
    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1106426]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found