Skip Menu |

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

Report information
The Basics
Id: 20884
Status: resolved
Priority: 0/
Queue: XML-DOM-XPath

People
Owner: MIROD [...] cpan.org
Requestors: ben.hsing [...] oracle.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.09
Fixed in: 0.11



Subject: findnodes errors out when looking for attribute or comment nodes
The following code using XML::XPath works: use XML::XPath; print $_->getData . "\n" for XML::XPath->new(xml => '<root><element1 attribute="e1"/><element2 attribute="e2"/></root>')->findnodes('//@*'); It outputs the values of all attributes properly: e1 e2 But the same code using XML::DOM::XPath fails: use XML::DOM::XPath; print $_->getData . "\n" for XML::DOM::Parser->new->parse('<root><element1 attribute="e1"/><element2 attribute="e2"/></root>')->findnodes('//@*'); It generates the following error message: axis axis_attribute not implemented [Can't use an undefined value as an ARRAY reference at /usr/lib/perl5/site_perl/5.8.6/XML/XPath/Step.pm line 220. ] The same happens applies to comment nodes: use XML::XPath; print $_->getData . "\n" for XML::XPath->new(xml => '<root><!--comment1--><!--comment2--></root>')->findnodes('//comment()'); outputs: comment1 comment2 But: use XML::DOM::XPath; print $_->getData . "\n" for XML::DOM::Parser->new->parse('<root><!--comment1--><!--comment2--></root>')->findnodes('//comment()'); generates the following error message: axis axis_descendant not implemented [Can't locate object method "isCommentNode" via package "XML::DOM::Element" at /usr/lib/perl5/site_perl/5.8.6/XML/XPath/Step.pm line 401. ] Please kindly look into this. Thanks a lot!! Best regards, Ben
Hi, Cute bug. It should be fixed and tested in the version currently on my site (http://xmltwig.com/module/xml-dom-xpath/). Let me know if the fix works for you, and I'll upload it to CPAN. Thanks for catching this. __ mirod
From: ben.hsing [...] oracle.com
On Tue Aug 08 10:17:46 2006, MIROD wrote: Show quoted text
> Hi, > > Cute bug. It should be fixed and tested in the version currently on my > site (http://xmltwig.com/module/xml-dom-xpath/). Let me know if the fix > works for you, and I'll upload it to CPAN. > > Thanks for catching this. > > __ > mirod
Thanks for the super fast turnaround, Michel!! If you test the fix with the two snippets of codes above, you'll find that the fix is good for the attribute nodes but not for the comment nodes. The same error still occurs when tested with a comment node search. Can you look further into this? Thanks again for all the efforts! Ben
On Tue Aug 08 12:57:00 2006, ben.hsing@oracle.com wrote: Show quoted text
> Thanks for the super fast turnaround, Michel!! If you test the fix with > the two snippets of codes above, you'll find that the fix is good for > the attribute nodes but not for the comment nodes. The same error still > occurs when tested with a comment node search. Can you look further into > this? Thanks again for all the efforts!
Oops! I had not read the end of the report. It's fixed now, along with the same thing using processing-instruction (which lead to finding a bug in XML::XPath, easily fixed as the proper code was there, just commented out. A fixed version of XML::XPath is on my web site). I hope I've fixed everything this time. __ mirod
From: ben.hsing [...] oracle.com
On Tue Aug 08 14:15:43 2006, MIROD wrote: Show quoted text
> On Tue Aug 08 12:57:00 2006, ben.hsing@oracle.com wrote: >
> > Thanks for the super fast turnaround, Michel!! If you test the fix with > > the two snippets of codes above, you'll find that the fix is good for > > the attribute nodes but not for the comment nodes. The same error still > > occurs when tested with a comment node search. Can you look further into > > this? Thanks again for all the efforts!
> > Oops! > > I had not read the end of the report. > > It's fixed now, along with the same thing using processing-instruction > (which lead to finding a bug in XML::XPath, easily fixed as the proper > code was there, just commented out. A fixed version of XML::XPath is on > my web site). > > I hope I've fixed everything this time. > > __ > mirod
Beautiful. All works flawlessly now. I did not find the update to XML::XPath on your website, however. Can you point me to it? Thanks again.:-) Ben
On Tue Aug 08 14:35:08 2006, ben.hsing@oracle.com wrote: Show quoted text
> Beautiful. All works flawlessly now. I did not find the update to > XML::XPath on your website, however. Can you point me to it? Thanks > again.:-)
http://xmltwig.com/xml-xpath-patched/ has the patched version of XML::XPath. I am posting the fixed version of XML::DOM::XPath to CPAN right now. __ mirod