Skip Menu |

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

Report information
The Basics
Id: 125452
Status: open
Priority: 0/
Queue: XML-Twig

People
Owner: Nobody in particular
Requestors: chrispitude [...] gmail.com
Cc:
AdminCc:

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



Subject: hyphen in tag name causes wrap_children() not to match tags
I am using wrap_children() to match a sequence of tags. If those tags have a hyphen in their tag name: $_->wrap_children('<example-line>', WITHDASH => {}) for $twig->descendants('topic'); then the match does not work: <example-line>foo</example-line> <example-line>foo</example-line> If the tags have no dash: $_->wrap_children('<exampleline>', NODASH => {}) for $twig->descendants('topic'); then the match works: <NODASH> <exampleline>foo</exampleline> </NODASH> <NODASH> <exampleline>foo</exampleline> </NODASH>
Subject: test.pl
#!/usr/bin/perl use strict; use warnings; use XML::Twig; my $xhtml = <<EOF; <?xml version="1.0" encoding="UTF-8"?> <chapter> <topic> <p>line</p> <example-line>foo</example-line> <example-line>foo</example-line> <p>line</p> </topic> <topic> <p>line</p> <exampleline>foo</exampleline> <exampleline>foo</exampleline> <p>line</p> </topic> </chapter> EOF my $twig=XML::Twig->new->parse($xhtml); $_->wrap_children('<exampleline>', NODASH => {}) for $twig->descendants('topic'); $_->wrap_children('<example-line>', WITHDASH => {}) for $twig->descendants('topic'); $twig->print(pretty_print => 'indented');
Subject: Re: [rt.cpan.org #125452] hyphen in tag name causes wrap_children() not to match tags
Date: Fri, 1 Jun 2018 17:35:12 +0200
To: bug-XML-Twig [...] rt.cpan.org
From: mirod <xmltwig [...] gmail.com>
Duh! \w+ does not match an XML identifier! Fixing it right now. Thanks -- mirod On 01/06/18 13:29, chrispitude@gmail.com via RT wrote: Show quoted text
> Fri Jun 01 07:29:33 2018: Request 125452 was acted upon. > Transaction: Ticket created by chrispitude@gmail.com > Queue: XML-Twig > Subject: hyphen in tag name causes wrap_children() not to match tags > Broken in: 3.52 > Severity: Normal > Owner: Nobody > Requestors: chrispitude@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=125452 > > > > I am using wrap_children() to match a sequence of tags. If those tags have a hyphen in their tag name: > > $_->wrap_children('<example-line>', WITHDASH => {}) for $twig->descendants('topic'); > > then the match does not work: > > <example-line>foo</example-line> > <example-line>foo</example-line> > > If the tags have no dash: > > $_->wrap_children('<exampleline>', NODASH => {}) for $twig->descendants('topic'); > > then the match works: > > <NODASH> > <exampleline>foo</exampleline> > </NODASH> > <NODASH> > <exampleline>foo</exampleline> > </NODASH> >