http://www.perlmonks.org?node_id=503297

anniyan has asked for the wisdom of the Perl Monks concerning the following question:

I have done small program using xml::Twig, i have used pretty_print for printing. It has different form of printing like, nice, indented etc. But i dont want any kind of style. I want same form as input with changes given in the program. How to attain this? I tried none but it is not giving what i expected.

Regards,
Anniyan
(CREATED in HELL by DEVIL to s|EVILS|GOODS|g in WORLD)

Replies are listed 'Best First'.
Re: xml::twig pretty_print
by mirod (Canon) on Oct 27, 2005 at 12:15 UTC

    You can get the same formating as in the original file by using the keep_spaces => 1 option when you create the twig. Note that this will create #PCDATA (text) elements that contain the whitespaces in your tree.

    Update: I updated the FAQ with this question.

Re: xml::twig pretty_print
by murugu (Curate) on Oct 27, 2005 at 11:25 UTC

    Hi anniyan,

    Up to my knowledge, XML::Twig uses pretty_print=none as default. I dont think there is a way to retain the output alignment style asis in the input. Any way the output is also an valid XML right.

    Regards,
    Murugesan Kandasamy
    use perl for(;;);