XML::Parser::Expat is just the lower level interface to Expat used by XML::Parser. It is no more venerable than XML::Parser.
XML::Parser is an object factory. Every time an XML::Parser object calls its parse or parsefile method, it calls XML::Parser::Expat to create a new parser object. So it does just what you do. And if you don't need any handler there is no need to call setHandlers, there will be no handler set by default.
As XML::Parser is kinda the official interface to XML::Parser::Expat, and although your code might be marginally faster, I would prefer a slightly improved version of davorg's code, where the creation of the XML object is pulled out of the loop:
my $p = XML::Parser->new; # needs to be done only once foreach (@list_of_20_000_files) { eval { $p->parsefile($_) }; # creates a new XML::Parser::Exp +at object if ($@) { print "$_ is bad\n"; } else { print "$_ is good\n"; } }
In reply to Re: Re: well formed xml
by mirod
in thread well formed xml
by marvell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |