<identity> is not an HTML tag, so there is no reason for it to be output
as <identity />
The empty tag style is really useful only if you're outputting XHTML and
want ancient versions of browsers to display it properly.
In your case you're outputting XML. Any XML processor you will use on
the output will not care whether the tag is expanded or not.
So I don't think there is a bug here.
--
mirod
On 20/07/16 06:35, Lin, Becky via RT wrote:
Show quoted text> Queue: XML-Twig
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=116315 >
>
> Code:
> sub addBullseyeDataLoadingHook{
> print "\n=========Now add bullseye hook in testset files=========\n";
> for my $testSetFile (@allTestSetNames) {
> print "\nProcessing testset file: ".$testSetFile."\n";
> my $roots = { test_set => 1};
> my $handlers = { 'opt/test_set' => \&tweak_server};
> my $twig = new XML::Twig(twigRoots => $roots,
> twigHandlers => $handlers,
> pretty_print => 'indented');
>
>
> $twig->parsefile($testSetFile);
> $twig->set_empty_tag_style ('html'); #intend to get xml with tag like <tag />
>
> #Write back the contents with added bullseye
> open(my $testsetFileHandle,'>', $testSetFile);
> $twig->print($testsetFileHandle);
> close($testsetFileHandle);
> $twig->dispose;
> }
> }
>
> I got the output as below:
> <identities>
> <identity name="ax_id" value="24114"></identity>
> <identity name="utms_domain" value="USD"></identity>
> <identity name="utms_project" value="Midrange"></identity>
> <identity name="utms_team_name" value="MRQE-ANT"></identity>
> <identity name="utms_cycle_id" value="26969"></identity>
> <identity name="utms_user_email" value="Thomas.Halchuk@emc.com"></identity>
> <identity name="utms_address" value="utmswebserver01:8082"></identity>
> </identities>
> While I hope to get as below:
> <identities>
> <identity name="ax_id" value="24114" />
> <identity name="utms_domain" value="USD" />
> <identity name="utms_project" value="Midrange" >
> <identity name="utms_team_name" value="MRQE-ANT" />
> <identity name="utms_cycle_id" value="26969" />
> <identity name="utms_user_email" value="Thomas.Halchuk@emc.com" />
> <identity name="utms_address" value="utmswebserver01:8082" />
> </identities>
>
> I also tried expand, and get result as below.
> #############expand #####################
> <identities>
> <identity name="ax_id" value="24114">
> </identity>
> <identity name="utms_domain" value="USD">
> </identity>
> <identity name="utms_project" value="Midrange">
> </identity>
> <identity name="utms_team_name" value="MRQE-ANT">
> </identity>
> <identity name="utms_cycle_id" value="26969">
> </identity>
> <identity name="utms_user_email" value="Thomas.Halchuk@emc.com">
> </identity>
> <identity name="utms_address" value="utmswebserver01:8082">
> </identity>
> </identities>
> -----Original Message-----
> From: xmltwig@gmail.com via RT [mailto:bug-XML-Twig@rt.cpan.org]
> Sent: Tuesday, July 19, 2016 3:36 PM
> To: Lin, Becky
> Subject: Re: [rt.cpan.org #116315] A bug for XML::Twig
>
> <URL:
https://rt.cpan.org/Ticket/Display.html?id=116315 >
>
> Hi Becky,
>
> I am not sure I understand the problem. Could you give me an example of code, with the expected output and the actual one.
>
> For example this:
>
> perl -MXML::Twig -E'$d=q{<html><head><script/><meta content="foo"
> value="bar"/></head><body><p></p><p/><br/></body></html>};
> $t=XML::Twig->new()->parse( $d); $t->set_empty_tag_style( "html"); $t->print; '
>
> outputs this:
>
> <html><head><script></script><meta content="foo" value="bar"
> /></head><body><p></p><p></p><br /></body></html>
>
> Which is what I would expect (script and p are not defined as empty tags in HTML, but meta and br are.
>
> Thanks
>
> --
> mirod
>
>
> On 19/07/16 07:27, Lin, Becky via RT wrote:
>> Tue Jul 19 01:27:07 2016: Request 116315 was acted upon.
>> Transaction: Ticket created by Becky.Lin@emc.com
>> Queue: XML-Twig
>> Subject: A bug for XML::Twig
>> Broken in: (no value)
>> Severity: (no value)
>> Owner: Nobody
>> Requestors: Becky.Lin@emc.com
>> Status: new
>> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=116315 >
>>
>>
>> Hi,
>>
>> Recently I am using XML::Twig for Perl script developing. It is really a great module and saves me a lot of time to deal files. I appreciate for your great work. Thanks.
>>
>> To help to enhance this module, there is a small issue I would like to share with you. The function set_empty_tag_style doesn't work as expected. The description is as below. But I found 'html' act as <tag></tag>, and 'expand' acts as <tag>carriage</tag>. No option for <tag />. Would you help to fix?
>> set_empty_tag_style ($style)
>>
>> Set the empty tag display style ('normal', 'html' or 'expand'). As with set_pretty_print<
http://search.cpan.org/perldoc?set_pretty_print> this sets a global flag.
>>
>> normal outputs an empty tag '<tag/>', html adds a space '<tag />' for elements that can be empty in XHTML and expand outputs '<tag></tag>'
>> By the way, my module is already the latest version 3.49.
>>
>> Best Regards!
>> Becky Lin
>> EMC China CoE | Chengdu
>> Tel: +86 28 8296 6771
>> Mobile: +86 183 4926 9098
>>
>>
>
>
>