in reply to XML::Twig problem

OK, it looks like I did not process properly parameter entities.

It's fixed in the development version, let me know if it works for you.

Replies are listed 'Best First'.
Re^2: XML::Twig problem
by BenHopkins (Sexton) on May 31, 2007 at 22:12 UTC
    It works. Thanks. But (you knew there would be a but, didn't you?), in the output, there was some trailing text after the final tag, which went away when I took out the flush() call.

    Also, when I tried to verify the soundness of the outputted XML with xml_pp (mine, not yours), it got this error:Undefined subroutine &Text::Wrap::wrap called at /usr/local/perl/5.8.2/lib/site_perl/5.8.2/XML/Twig.pm line 7476. When I replaced indented_c with nice, it worked.

      Indeed the flush messes things up when you're using twig_print_outside_roots. I should check for that, I'll see what I can do. In fact, with recent versions of the module, the flush after the end of the parsing is no longer needed. The module assumes that if you started flushing, then you want to keep on doing it (or you would most likely get non well-formed XML), so at the end of the parse, if flush has been used on the twig, it performs a last flush, using the filehandle that was used for the first flush. It DWIMs better that it reads ;--(.

      As for the xml_pp problem, I don't know, maybe you redefined the constants and you ended up using the one for 'wrapped' or 'cvs' instead of the one for 'indented_c' ? What's the value you are using for the style? BTW I usually use xmlwf, xmllint or perl -MXML::Parser -e'XML::Parser->new( ErrorContext => 1)->parsefile( shift())' file.xml to check the well-formedness of the XML.