Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: XML::Twig modify data, and I don't want that

by mirod (Canon)
on Sep 16, 2013 at 13:09 UTC ( #1054291=note: print w/ replies, xml ) Need Help??


in reply to XML::Twig modify data, and I don't want that

This is a funny one. And it shows a bug in the module.

The problem is the line in the handler that creates the element using paste. It creates a new twig, and messes up the options on the "main" one.

So the workaround is to replace that line with this:

$elt= XML::Twig->parse( keep_encoding=>1, qq(<p>test</p>) )->root->cut;

This way keep_encoding is preserved and you get the result you want

,p>Then I have to fix this in the module, and hopefully in the next version your code will run as-is (you should really write XML::Twig::Elt->parse instead of using the indirect object syntax though).


Comment on Re: XML::Twig modify data, and I don't want that
Select or Download Code
Replies are listed 'Best First'.
Re^2: XML::Twig modify data, and I don't want that
by physi (Friar) on Sep 16, 2013 at 13:17 UTC
    Cheers for that !
    havn't thought of using keep_encoding in the parse part.

    And thank you for that great module !

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1054291]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (14)
As of 2015-07-30 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls