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

Report information
The Basics
Id:
18789
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
MIROD [...] cpan.org
Requestors:
memfrob [...] memfrob.de
Cc:
AdminCc:

BugTracker
Severity:
Normal
Broken in:
3.23
Fixed in:
3.24

Attachments


Subject: xpath root selector return twig object, not root element
The get_xpath code returns the containing XML::Twig object instead of the root XML::Twig::Elt element for '/'. This also causes xpath expressions like '/gi[1]' to die with "Can't locate object method "child" via package "XML::Twig" at (eval 13) line 1."
Subject: xpath-root-selector.patch
--- Twig.pm 2006-04-19 19:00:43.000000000 +0200 +++ Twig.pm.mod 2006-04-19 19:03:15.000000000 +0200 @@ -5597,7 +5597,7 @@ # grab the root if expression starts with a / if( $xpath_exp=~ s{^/}{}) - { $sub .= '@results= ($elt->twig);'; } + { $sub .= '@results= ($elt->root);'; } elsif( $xpath_exp=~ s{^\./}{}) { $sub .= '@results= ($elt);'; } else
Hi I believe the fact that get_xpath returns the twig itself for '/' is OK, I fixed the bug for '/doc[1]' though in the development version on http://xmltwig.com/xmltwig/ let me know if it works for you. BTW, why do you need a query like '/doc[1]'? It looks pretty useless as far as I can tell. __ mirod
From: memfrob@memfrob.de
Hi
Show quoted text
> I believe the fact that get_xpath returns the twig itself for '/' is OK, > I fixed the bug for '/doc[1]' though in the development version on > http://xmltwig.com/xmltwig/ let me know if it works for you.
It does.
Show quoted text
> BTW, why do you need a query like '/doc[1]'? It looks pretty useless as > far as I can tell.
You're absolutely right, my bad. I thought '/' would already select the document tag, but of course that would be '/doc-gi'. So the problem was my misunderstanding of the xpath spec, rather than a bug in XML::Twig. Sorry for the confusion, and thanks for the prompt reply. Enno


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.