PHP Manual
This manual is provided as a courtesy. It is not an official source. Please check php.net for updated information.
(no version information, might be only in CVS)
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.
Example 1. Retrieving root element
<?phpinclude("example.inc");if (!$dom = domxml_open_mem($xmlstr)) { echo "Error while parsing the document\n"; exit;}$root = $dom->document_element();print_r($root);?>
The above example will output:
domelement Object ( [type] => 1 [tagname] => chapter [0] => 6 [1] => 137960648 )