I want to parse a xml string into as XML document(DOM). I know how to do this when xml is stored in different file, example given at
http://www.w3schools.com/php/php_xml_dom.asp
$xmlDoc = new DOMDocument();
$xmlDoc->load(file.xml);
Now we can access the $xmlDoc as a document object, and we can access and manipulate xml using DOM methods. But I want to parse a xml string as a document.I tried
$xmlstring = '
<users>
<user>
<name> nikhil </name>
<password>1234 </password>
</user>
<user>
<name>akhil </name>
<password>123 </password>
</user>
</users>';
$xmlDoc = new DOMDocument();
$xmlDoc->load($xmlstring);
But this does not work, any ideas?
load(), use theloadXML()method.