Q: problem parsing xml with simplexml I'm trying to parse some xml using simplexml and php...it's being returned to me from a service like so:
<DMResponse><Code>2</Code><Description>Your request was successfully received You will        receive notification once the process has been completed.</Description><ResultData><Explanation>     The job name is 578bbn004 </Explanation></ResultData></DMResponse>

I pasted this from the .net panel in firebug.
This is how I'm trying to parse is using php:
$result = curl_exec($ch);
print 'xml ' . $result . ' xml';
$xml = new SimpleXMLElement($result);
$code = $xml->code;
echo $code;

$result is deinfitely populated...I get it back in the print statement above....it contains the xml structure I've posted.
The error I'm getting is 'String could not be parsed as XML'. I don't understand why it's doing this. Any ideas?

A: Try $xml = simplexml_load_string($result); ... I've never done it the way you're doing it. That's not to say that it won't work, though.
Edit: If simplexml_load_string() doesn't work, your string may contain some (nonprintable) invalid characters or something like that.

A: To print your SimpleXML Object, you have to use $xml->asXML() (to print into a file $xml->asXML(file_name)).
If you still have an error :
What is print when you add this code just after $xml = new SimpleXMLElement($result);
 ?
echo "<pre>";
var_dump($xml);
echo "</pre>";
die();

