I am having some problems with the XML::Parser 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::Parser;

my $sourceXML="<h><j>whatever</j></h>";

my $parser = new XML::Parser();

$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 {
}


This exact code works fine on another machine. Any ideas?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to