Subject: | RNG constructor returns undef with doc parameter |
Here's some code to demonstrate:
use XML::LibXML;
#this one works
my $rng = XML::LibXML::RelaxNG->new(string =>
'<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
<text/>
</element>');
die 'blah' unless $rng; #doesn't die
#but this one doesn't
my $rng_doc = XML::LibXML->load_xml(string =>
'<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0">
<text/>
</element>');
$rng = XML::LibXML::RelaxNG->new( doc => $rng_doc );
die 'what?!' unless $rng; #dies
I wanted to use the doc version of the constructor because I could pass a string pointer to the doc constructor. However, using the doc constructor to create an RNG validator always returns undef! The documentation mentions errors leading to die(), but this program lives and has bad output.