(PHP 5)

simplexml_import_dom --  Get a SimpleXMLElement object from a DOM node.


SimpleXMLElement simplexml_import_dom ( DOMNode node [, string class_name] )

This function takes a node of a DOM document and makes it into a SimpleXML node. This new object can then be used as a native SimpleXML element. If any errors occur, it returns FALSE.

Example 1. Import DOM

= new domDocument;
if (!
$dom) {
'Error while parsing the document';

$s = simplexml_import_dom($dom);

$s->book[0]->title; // blah

See also dom_import_simplexml().

© Copyright 2003-2014 The ultimate PHP Editor and PHP IDE site.