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.
In reply to Re: xml::twig pretty_print
by mirod
in thread xml::twig pretty_print
by anniyan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |