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

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

xml_writer constructs this preface:
<?xml version="1.0"?>
Is there anything else that (advisedly) might be included?

Replies are listed 'Best First'.
Re: xml document preface
by Your Mother (Archbishop) on May 20, 2013 at 15:52 UTC
    perl -MXML::LibXML -le 'print XML::LibXML->load_xml( string => "<root/ +>" )->serialize' <?xml version="1.0"?> <root/>

    Agreement there. The encoding needs to be included if it's anything past ASCII/encoded entities.

Re: xml document preface
by sundialsvc4 (Abbot) on May 21, 2013 at 20:02 UTC

    This-much, of course, is the minimal specification needed to say, “this is an XML file,” and absent any encoding issues.   Has anyone experimented with that, to see if encoding directives are ever included, in some appropriate circumstance?