Subject: | preserving quotes in and around attributes |
Date: | Thu, 6 Jun 2013 12:07:08 -0700 (PDT) |
To: | "bug-XML-Twig [...] rt.cpan.org" <bug-XML-Twig [...] rt.cpan.org> |
From: | Arun Lakhana <ooeh [...] yahoo.ca> |
Hi,
This might be a bug (or else a feature request)...
Currently, XML-Twig does not properly handle attribute values that are surrounded by and that contain mixed quote types. It would be great if there were a 'preserve_quote' option (in addition to 'set_quote').
E.g.
Processing the following valid XML through XML-Twig:
<label1 attr='This "works"!'/><label2 attr="This 'works'!"/>
Results in invalid XML (nested double quotes in label1):
<label1 attr="This "works"!"/>
<label2 attr="This 'works'!"/>
Using:
$twig->set_quote('single');
shifts the problem to label2 (nested single quotes in label2).
Sample code is here: http://stackoverflow.com/questions/16947640/perl-xmltwig-preserving-quotes-in-and-around-attributes
I found this problem occurs with:
- Strawberry perl v5.16.3 built for MSWin32-x86-multi-thread with XML-Twig v3.44
- ActiveState v5.8.9 built for MSWin32-x86-multi-thread with XML-Twig 3.40
Otherwise, this module is fantastic!
Thank you!
Arun