DOMComment->__construct()
(PHP 5)
DOMComment->__construct() — Crea un nuovo oggetto DOMComment
Descrizione
DOMComment
__construct
([ string $value
] )
Crea un nuovo oggetto DOMComment. Questo oggetto è in sola lettura. Può essere aggiunto ad un documento, ma non si possono inserire nodi aggiuntivi a questo nodo sino a quando il nodo è associato al docuemnto. Per creare un modo modificabile utilizzare DOMDocument->createComment().
Elenco dei parametri
- value
-
Il testo del commento.
Esempi
Example#1 Esempio di creazione di un nuovo DOMComment
<?php
$dom = new DOMDocument('1.0', 'iso-8859-1');
$element = $dom->appendChild(new DOMElement('root'));
$comment = $element->appendChild(new DOMComment('root comment'));
echo $dom->saveXML(); /* <?xml version="1.0" encoding="iso-8859-1"?><root><!--root comment--></root> */
?>