RE: lost node at /usr/lib/perl5/XML/LibXML.pm line 1205.
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <20080806135533.1b9464daa9dc9a48766560ccb190ad43.05612431df.wbe@email.secureserver.net> |
I'm questioning these 2 lines a bit. my ($doc) = readfile($ARGV[0]); bless($doc, 'XML::LibXML::Document'); You shouldn't need the ()'s around ($doc) in the 1st line, though it shouldn't cause any problems. The 'bless()' I'd get rid of entirely, it just shouldn't need to be there, the $doc will be whatever it needs to be since the LibXML bindings created it. This might be the root of your problem. Also, the return in your readfile() function, just do 'return $doc;' you don't need anything beyond that, and again that might be related to the problem. HTH ;) -------- Original Message -------- Subject: lost node at /usr/lib/perl5/XML/LibXML.pm line 1205. From: "Jonas_Häggqvist" <[email protected]> Date: Wed, August 06, 2008 1:47 pm To: [email protected] I'm getting a strange error when doing getElementsByTagName() on a Document. Admittedly it could be related to my sub-par Perl-fu, but it seems like I should at least not get a segfault it things were working correctly. The minimal example below shows this behaviour. $ cat temp.pl #!/usr/bin/perl use XML::LibXML; sub readfile { my ($file) = @_; $doc = XML::LibXML->new->parse_file($file); return \($doc); } my ($doc) = readfile($ARGV[0]); bless($doc, 'XML::LibXML::Document'); my $elements = $doc->getElementsByTagName("bar"); $ cat temp.xml <?xml version='1.0' encoding='UTF-8'?> <foo> <bar>test</bar> </foo> $ perl temp.pl temp.xml lost node at /usr/lib/perl5/XML/LibXML.pm line 1205. Segmentation fault -- Jonas Häggqvist _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs