array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ru', ), 'this' => array ( 0 => 'domtext.construct.php', 1 => 'DOMText::__construct', ), 'up' => array ( 0 => 'class.domtext.php', 1 => 'DOMText', ), 'prev' => array ( 0 => 'class.domtext.php', 1 => 'DOMText', ), 'next' => array ( 0 => 'domtext.iselementcontentwhitespace.php', 1 => 'DOMText::isElementContentWhitespace', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ru', 'path' => 'reference/dom/domtext/construct.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
data
Значение текстового узла. Если значение не передано, будет создан пустой текстовый узел.
Пример #1 Создание нового узла DOMText
<?php
$dom = new DOMDocument('1.0', 'iso-8859-1');
$element = $dom->appendChild(new DOMElement('root'));
$text = $element->appendChild(new DOMText('root value'));
echo $dom->saveXML(); /* <?xml version="1.0" encoding="iso-8859-1"?><root>root value</root> */
?>