officially, the w3 specifies that the way to access dom interfaces is through this class
so if you use
$doc = new DOMDocument("1.0", "UTF-8");
use instead:
$x = new DOMImplementation();
$doc = $x->createDocument(NULL,"rootElementName");
$doc->xmlVersion="1.0";
$doc->xmlEncoding="UTF-8";
it is not required by php's implementation, but, probably, it is a good practice
see:
http://w3.org/TR/DOM-Level-3-Core/core.html#DOMImplementation
http://w3.org/TR/DOM-Level-3-Core/core.html#DOMImplementationList
http://w3.org/TR/DOM-Level-3-Core/core.html#DOMImplementationSource
The DOMImplementation class
(PHP 5)
Introduction
The DOMImplementation interface provides a number of methods for performing operations that are independent of any particular instance of the document object model.
Class synopsis
DOMImplementation
{
/* Properties */
/* Methods */
__construct
( void
)
DOMDocument createDocument
([ string
$namespaceURI = NULL
[, string $qualifiedName = NULL
[, DOMDocumentType $doctype = NULL
]]] )
DOMDocumentType createDocumentType
([ string
}$qualifiedName = NULL
[, string $publicId = NULL
[, string $systemId = NULL
]]] )Table of Contents
- DOMImplementation::__construct — Creates a new DOMImplementation object
- DOMImplementation::createDocument — Creates a DOMDocument object of the specified type with its document element
- DOMImplementation::createDocumentType — Creates an empty DOMDocumentType object
- DOMImplementation::hasFeature — Test if the DOM implementation implements a specific feature
giorgio dot liscio at email dot it ¶
2 years ago
