H
Hooby
I have been using the wonderful XML:
arser on a winXP box successfully for
a long time now. Unfortunately, I have several (hundred?) thousand XML files
that I process on a weekly basis. Every so often - say 1 in 10,000 might be
badly formed (but which one?). When XML:
arser hits one of these it dies
(just as the documentation says it would). BTW - I have no control over the
badly formed XML if it occurs - I just have deal with what I am given...
Is there a way to trap or change this behaviour so that I can pass over the
offending file gracefully and let the program continue with the others (it
takes several hours to complete - amd I don't mind missing one file
occasionally). In other words can I trap the error in perl to make it a warn
not a die?
Any suggestions gratefully received!
Thanks Andy
Typical usage as seen below :
use XML:
arser;
$parser = new XML:
arser(Style=>'Subs', Pkg=>'SubHandlers', ErrorContext =>
2);
$parser->setHandlers( Start => \&startElement,
End => \&endElement,
Char => \&characterData
);
$currentfile = $filename;
$parser->parsefile($currentfile); # open up and parse the classification
scheme to find out what filelists were created and generate indexes as it
goes
a long time now. Unfortunately, I have several (hundred?) thousand XML files
that I process on a weekly basis. Every so often - say 1 in 10,000 might be
badly formed (but which one?). When XML:
(just as the documentation says it would). BTW - I have no control over the
badly formed XML if it occurs - I just have deal with what I am given...
Is there a way to trap or change this behaviour so that I can pass over the
offending file gracefully and let the program continue with the others (it
takes several hours to complete - amd I don't mind missing one file
occasionally). In other words can I trap the error in perl to make it a warn
not a die?
Any suggestions gratefully received!
Thanks Andy
Typical usage as seen below :
use XML:
$parser = new XML:
2);
$parser->setHandlers( Start => \&startElement,
End => \&endElement,
Char => \&characterData
);
$currentfile = $filename;
$parser->parsefile($currentfile); # open up and parse the classification
scheme to find out what filelists were created and generate indexes as it
goes