English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The simplexml_import_dom() function is used to obtain a SimpleXMLElement object from a DOM node.
simplexml_import_dom(node, classname);
Returns a SimpleXMLElement object from the DOM node
Returns a SimpleXMLElement object on success, false on failure
Number | Parameters and Description |
---|---|
1 | node Specify the DOM element node |
2 | classname Specify the class of the new object |
Try the following example to get the DOM document node and convert it to a SimpleXML node:
<?php //Get the DOM document node and convert it to a SimpleXML node $dom = new domDocument; $dom->loadXML("<car><local><title Title1</title></local><local><title> Title2</title></local></car>"); $x = simplexml_import_dom($dom); echo $x->local[1]->title; ?>Test and See‹/›
Output Result
Title2