Skip Menu | will be shut down on March 1st, 2021.

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 38291
Status: resolved
Priority: 0/
Queue: XML-LibXML

Owner: Nobody in particular
Requestors: patp [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

CC: patp [...]
Subject: Can't locate object method "_newForString" via XML::LibXML::Reader
Date: Thu, 07 Aug 2008 10:43:55 -0400
To: bug-XML-LibXML [...]
From: Patrick Peterson <patp [...]>
Download (untitled) / with headers
text/plain 1.4k
Description: I can't get XML::LibXML::Reader->new() to work for location or string arguments. See example below. I may be missing something simple, because I can't get any of the examples from XML or CPAN sites to work. Release: XML-LibXML-1.66 Show quoted text
>>>> perl -v
This is perl, v5.8.8 built for x86_64-linux-thread-multi Show quoted text
>>>> uname -a
Linux 2.6.9-42.ELsmp #1 SMP Tue Aug 15 10:35:26 BST 2006 x86_64 x86_64 x86_64 GNU/Linux Show quoted text
>>>> cat
#!/usr/bin/perl my $xml = <<'EOF'; <parent a='A' b='B'> <child a='A' b='B'> <gchild a='A' b='B'> a</gchild> </child> </parent> EOF use XML::LibXML; use XML::LibXML::Reader; my $r = XML::LibXML::Reader->new(string => $xml); while ($r-> read) { if ($r-> nodeType == XML_READER_TYPE_ELEMENT) { print "-----------------\n"; print "Element ". $r-> name,"\n"; # several ways of reading attributes: # read all attributes: if ($r-> moveToFirstAttribute) { do {{ print "Attribute ",$r-> name(), " => ",$r->value,"\n"; }} while ($r-> moveToNextAttribute); $r-> moveToElement; } # back at the element # ... # read a specific attribute: print "----\n"; print "Attribute b: ",$r-> getAttribute('b'),"\n"; } } __END__ Show quoted text
Can't locate object method "_newForString" via package "XML::LibXML::Reader" at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/XML/LibXML/ line 159. Thanks for your help, I love XML::LibXML. Pat Peterson
Download (untitled) / with headers
text/plain 322b
I suppose your libxml2 is compiled without reader support. Have a look at the output from: xmllint --version It should contain the string 'Reader'. For the next release, I've just added a check to the Reader module so that one gets a more informative error in the moment one does use XML::LibXML::Reader. -- Petr

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to