in reply to XML::Twig and HTML Entities

maybe I'm missing something but the output looks exactly as I would expect... Can you post an example of what you'd prefer XML::Twig to output?

Replies are listed 'Best First'.
Re^2: XML::Twig and HTML Entities
by blitzkrieg (Initiate) on Nov 12, 2004 at 20:01 UTC
    Here's what the code snippet actually generates:
    <?xml version="1.0" encoding="utf-8"?> <log>&amp;lt;pre&gt;won't escape properly - uggh!&amp;lt;/pre&gt;</log +>
    Here's what I desire?
    <?xml version="1.0" encoding="utf-8"?> <log>&lt;pre&gt;won't escape properly - uggh!&lt;/pre&gt;</log>
    Notice that it does an encode_entities() on the '&' in both of the '&lt;' series. I either want XML::Twig to encode everything or nothing but not a partial encode.
      Why not? Without an opening '<' a '>' is a normal char and doesn't need to encode().
        Update:

        It turns out in the code excerpt I wrote to demonstrate my problem, the problem is easily solved by setting 'keep_encoding => 1' when the Twig is created.

        In the actual code that is trying to do this same thing, 'keep_encoding => 1' is set but the output behaves like it is not set. And I get the behavior described in the original message. Maybe this additional information will ring a bell with someone.