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 clase DOMImplementation
(PHP 5)
Introducción
La interfaz DOMImplementation proporciona varios métodos para realizar operaciones que son independientes de cualquier instancia en particular del modelo de objetos del documento.
Sinopsis de la Clase
DOMImplementation
{
/* Propiedades */
/* Métodos */
__construct
( void
)
DOMDocument createDocument
([ string
$namespaceURI = NULL
[, string $qualifiedName = NULL
[, DOMDocumentType $doctype = NULL
]]] )
DOMDocumentType createDocumentType
([ string
}$qualifiedName = NULL
[, string $publicId = NULL
[, string $systemId = NULL
]]] )Tabla de contenidos
- DOMImplementation::__construct — Crea un nuevo objeto DOMImplementation
- DOMImplementation::createDocument — Crea un objeto DOMDocument del tipo especificado con su elemento documento
- DOMImplementation::createDocumentType — Crear un objeto DOMDocumentType vacío
- DOMImplementation::hasFeature — Comprueba si la implementación de DOM implementa una característica específica
giorgio dot liscio at email dot it ¶
2 years ago
