How to get xml child value with php SimpleXMLElement [closed]

meufmsn

New Member
My xml is:\[code\]<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org/"><?xml version="1.0" encoding="utf-8"?><root><msg>Error - Invalid password</msg></root></string>\[/code\]I'm trying to get the msg value with this code, but it doesn't work:\[code\]$string = '<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org/"><?xml version="1.0" encoding="utf-8"?><root><msg>Error - Invalid password</msg></root></string>';$xml = new SimpleXMLElement($string);echo $xml->msg;\[/code\]For any other xml that doesn't contain the \[code\]<?xml version="1.0" encoding="utf-8"?>\[/code\] the code works fine.
 
Back
Top