@Jarl
Not sure if this is what you meant when you said "The constructor example clearly shows that version and encoding only end up in the XML header", but you can also affect other parameters in the generated XML header, by accessing the DOMDocument's properties, for example:
<?php
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->xmlStandalone = false;
echo $dom->saveXML();
// <?xml version="1.0" encoding="UTF-8" standalone="no"?>
DOMDocument->__construct()
(PHP 5)
DOMDocument->__construct() — Creates a new DOMDocument object
Descrição
DOMDocument
__construct
([ string $version
[, string $encoding
]] )
Creates a new DOMDocument object.
Parâmetros
- version
-
The version number of the document as part of the XML declaration.
- encoding
-
The encoding of the document as part of the XML declaration.
Exemplos
Example#1 Creating a new DOMDocument
<?php
$dom = new DOMDocument('1.0', 'iso-8859-1');
echo $dom->saveXML(); /* <?xml version="1.0" encoding="iso-8859-1"?> */
?>
User Contributed Notes
DOMDocument->__construct()
DOMDocument->__construct()
dave at revlob dot com
14-Feb-2008 08:07
14-Feb-2008 08:07
bholbrook at servillian dot com
05-Dec-2007 08:25
05-Dec-2007 08:25
Make sure that php_domxml.dll on windows is removed before using the domdocument class as they cannot coexist.
jarl kringelding skim punt com
24-Sep-2007 06:22
24-Sep-2007 06:22
Be aware using the encoding parameter in the constructor.
It does not mean that all data is automatically encoded for you in the supplied encoding. You need to do that yourself once you choose an encoding other than the default UTF-8. See the note on DOM Functions on how to properly work with other encodings...
The constructor example clearly shows that version and encoding only end up in the XML header.

DOMComment->__construct()