Skip Menu |

This queue is for tickets about the HTML-Selector-XPath CPAN distribution.

Report information
The Basics
Id: 73719
Status: resolved
Priority: 0/
Queue: HTML-Selector-XPath

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

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



Subject: Add a prefix option to the to_xpath method.
Given a selector like this: div p It generates an XPath like this: //div//p The attached patch allows you to pass an optional prefix for elements to the output: //xhtml:div//xhtml:p This is useful given: http://search.cpan.org/~shlomif/XML-LibXML-1.89/lib/XML/LibXML/ Node.pod#findnodes
Subject: hsxp-prefix.diff
--- /usr/lib/perl5/site_perl/5.10.1/HTML/Selector/XPath.pm 2011-11-24 22:14:11.000000000 +0000 +++ lib/XML/LibXML/QuerySelector/ToXPath.pm 2012-01-03 22:39:44.410280697 +0000 @@ -139,6 +139,11 @@ } else { $tag = '*'; } + + if (defined $parms{prefix} and not $tag =~ /[*:|]/) { + $tag = join ':', $parms{prefix}, $tag; + } + if (! $wrote_tag++) { push @parts, $tag; $tag_index = $#parts;
Resolved in 0.13