in reply to Getting XML::Generator to DWIW with the XML declaration

The docs says the constructor's encoding option "Sets the default encoding for use in XML declarations."

The docs say "Prepends an XML declaration, and re-blesses the argument into a "final" class that can't be embedded." of the xml method.

The docs are wrong. The XML declaration is only prepended when conformance => 'strict'

use XML::Generator qw( ); my $gen = XML::Generator->new( conformance => 'strict', encoding => 'UTF-8', ); print $gen->xml( $gen->doc('...') );
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <doc>...</doc>

Did you want without strict?

Update: I just copied this from my pad. I should have made sure there wasn't anything new in the question first. I missed the bit about standalone.

Replies are listed 'Best First'.
Re^2: Getting XML::Generator to DWIW with the XML declaration
by jeffa (Bishop) on Nov 07, 2008 at 19:46 UTC

    Very close ... but i changed my requirements on you per our discussion in the CB. The trick now is to remove the standalone attribute. Nonetheless, thanks for the feedback. I was starting to think 12 months of solid PHP development had ... oh who i am kidding -- it HAS made my Perl rusty! :D

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)