Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

DomDocument->document_element

(no version information, might be only in CVS)

DomDocument->document_element --  Returns root element node

Описание

domelement DomDocument->document_element ( void )

This function returns the root element node of a document.

The following example returns just the element with name CHAPTER and prints it. The other node -- the comment -- is not returned.

Пример 1. Retrieving root element

<?php
include("example.inc");

if (!
$dom = domxml_open_mem($xmlstr)) {
  echo
"Error while parsing the document\n";
  exit;
}

$root = $dom->document_element();
print_r($root);
?>

Результат выполнения данного примера:

domelement Object
(
    [type] => 1
    [tagname] => chapter
    [0] => 6
    [1] => 137960648
)



add a note add a note User Contributed Notes
DomDocument->document_element
rianfowler no at spam gmail dot com
01-Apr-2007 05:51
The domelement returned by this will function as a domnode object for things like ->append_child.

$nodeChild = myxmldoc->create_element('child');
$nodeRoot = $this->myxmldoc->document_element();
$nodeRoot->append_child($nodeChild);
filipp at mac dot com
30-Dec-2006 02:29
as of PHP 5 (tested with 5.1.4), remember to use documentElement instead. As in:
$dom = new DomDocument ();
$dom -> load ('file.xml');
$newEl = $dom -> createElement ('newEl');
$dom -> documentElement -> appendChild ($newEl);

DomDocument->dump_file> <DomDocument->doctype
Last updated: Sat, 27 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571