PHP XML loadXML() Example

PHP XML loadXML() Example

Posted in : PHP Posted on : January 21, 2011 at 6:44 PM Comments : [ 0 ]

This section contains the detail about the loadXML() function in PHP.

PHP XML loadXML() Example:

If you want to load string data in the xml file then use loadXML() function. The loadXML() load xml from a string. This function return boolean (true for success or false for failure).

Example :

$doc = new DOMDocument();
$doc->loadXML('<root><node>Rose India</node></root>');
echo $doc->saveXML();

After running this example the browser output is:

Rose India

and the generated test.xml file code is:

<?xml version="1.0"?>
<root><node>Rose India</node></root>

Download Example Code

Go to Topic «PreviousHomeNext»

Your Comment:

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image

Tutorial Topics