I am having some problems with the XML:
arser module. It is returning an error when passed some valid xml in the form of a string. The error it returns is:
No element found at line 1, column 0 byte -1
This seems to suggest that the string is empty although if I print the string immediately prior to trying to parse it, the contents are fine.
Here is a copy of the code:
use XML:
arser;
my $sourceXML="<h><j>whatever</j></h>";
my $parser = new XML:
arser();
$parser->setHandlers( Start => \&hdl_start,
End => \&hdl_end,
Char => \&hdl_char
);
#=- Parse the document
print "Trying to parse:\n $sourceXML \n";
$parser->parse($sourceXML);
print "Completed successfully";
exit;
##====-- The Event Handlers used during parsing --====##
#=-- Tag Opened Event (this is called when a tag is first opened)
sub hdl_start{
}
#=-- Tag Closed Event (this is called when a tag is closed)
sub hdl_end{
}
#=-- Tag Data Event (this is called when data within tags is being processed)
sub hdl_char {
}
The exact same code works perfectly on another machine.
Any ideas?
No element found at line 1, column 0 byte -1
This seems to suggest that the string is empty although if I print the string immediately prior to trying to parse it, the contents are fine.
Here is a copy of the code:
use XML:
my $sourceXML="<h><j>whatever</j></h>";
my $parser = new XML:
$parser->setHandlers( Start => \&hdl_start,
End => \&hdl_end,
Char => \&hdl_char
);
#=- Parse the document
print "Trying to parse:\n $sourceXML \n";
$parser->parse($sourceXML);
print "Completed successfully";
exit;
##====-- The Event Handlers used during parsing --====##
#=-- Tag Opened Event (this is called when a tag is first opened)
sub hdl_start{
}
#=-- Tag Closed Event (this is called when a tag is closed)
sub hdl_end{
}
#=-- Tag Data Event (this is called when data within tags is being processed)
sub hdl_char {
}
The exact same code works perfectly on another machine.
Any ideas?