I am trying to parse XML files using the XML parser but it fails with the error when the Couldn't open /path to file.xml : No such file or directory at /usr/local/share/perl5/XML/Parser/PerlSAX.pm line 146.
The xml files does exist in the mentioned location.
This is how I am calling the my $parser = XML::Parser::PerlSAX->new( Handler => $RespHandler ); $parser->parse(Source => { SystemId => $ResponseXML });
I don't see any filename in the code fragment you posted. I guess it is hidden in $ResponseXML.
Anyway, try to print out the filename right before calling $parser->parse() to see if your idea of the filename and the filename actually used are the same. If you have no better idea, add
use Data::Dumper qw();
to the top of your script and
print Data::Dumper->new([$ResponseXML],['ResponseXML'])->Useqq(1)->Dum
+p(),"\n";
right before $parser->parse(). Running your script will give you debug output similar to this:
$ResponseXML = {
"Other" => [
"stuff",
"may also",
"appear"
],
"filename" => " /opt/XML/otherfile.xml\n"
};
Note that in my example, I added some common errors: leading space, trailing newline, different directory, different filename.
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
|