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
La classe DOMImplementation
(PHP 5)
Introduction
L'interface DOMImplementation fournit des méthodes pour effectuer des opérations qui sont indépendantes d'une instance particulière du modèle objet d'un document.
Synopsis de la classe
DOMImplementation
{
/* Propriétés */
/* Méthodes */
__construct
( void
)
DOMDocument createDocument
([ string
$namespaceURI = NULL
[, string $qualifiedName = NULL
[, DOMDocumentType $doctype = NULL
]]] )
DOMDocumentType createDocumentType
([ string
}$qualifiedName = NULL
[, string $publicId = NULL
[, string $systemId = NULL
]]] )Sommaire
- DOMImplementation::__construct — Crée un nouvel objet DOMImplementation
- DOMImplementation::createDocument — Crée un objet DOM Document du type spécifié avec ses éléments
- DOMImplementation::createDocumentType — Crée un objet DOMDocumentType vide
- DOMImplementation::hasFeature — Teste si l'implémentation DOM implémente une fonctionnalité spécifique
giorgio dot liscio at email dot it ¶
2 years ago
