How to use simplexml import dom in PHP

In this article I will explain how simplexml_ import_ dom function used in PHP.
  • 2063

simplexml_import_dom() Function

This function converts a DOM node to a SimpleXMLElement object.

Syntax

simplexml_import_dom(data,class)

 

 Parameter  Description
 data  It is required,In this Dom Node Used.
 class  It is optional,In this specify class of new object.

Example

<html>
<body>
<?php
$dom = new domDocument;
$dom->loadXML('<note><from>Sachin</from></note>');
$xml = simplexml_import_dom($dom);
echo $xml->from;
?>
</body>
</html>

 

Output


simple-xml-import-dom-php.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.