PHP simplexml_import_dom() Function
Definition and Usage
The simplexml_import_dom() function converts a DOM node to a SimpleXMLElement object.
If it fails, the function returns false.
Syntax
simplexml_import_dom(data,class)
Parameter | Description |
---|---|
data | Required. Specifies the DOM node to be used. |
class | Required. Specifies the class of the new object. |
Example
<?php $dom = new domDocument; $dom->loadXML('<note><from>John</from></note>'); $xml = simplexml_import_dom($dom); echo $xml->from; ?>
Output similar to:
John