in reply to well formed xml
Its documentation states:
Reviews of expat often state that one of its advantages is that it is fast. (For the record, expat is in C rather than in Perl.)setHandlers(TYPE, HANDLER [, TYPE, HANDLER ...])
This method registers handlers for the various events. If no handlers are registered, then a call to parsestring or parsefile will only determine if the corresponding XML document is well formed (by returning without error.) This may be called from within a handler, after the parse has started.
It is hard to imagine Larry Wall, who wrote version 1.0 of XML::Parser::Expat in order to provide "lowlevel access to James Clark's expat XML parser," bloating his code. Borrowing Davorg's suggested solution, the test would then be:
$parser = new XML::Parser::Expat; $parser->setHandlers(); open(FOO, 'info.xml') or die "Couldn't open"; eval { $parser->parse(*FOO) }; if ($@) { print "$_ is bad\n"; } else { print "$_ is good\n"; } close(FOO);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: well formed xml
by mirod (Canon) on Feb 28, 2001 at 22:14 UTC |