PHP未捕获异常'Exception',消息'String无法解析为XML

i have a problem with the php function SimpleXMLElement. This is my code:

 echo $xmldata;
 $nodes = new SimpleXMLElement($xmldata);  

Whit this code i have the output below:

 <?xml version="1.0" encoding="utf-8"?>
 <node>
   <node>
     <title>CONTENT DI PROVA</title>
     <body>CIAO CIAO
 </body>
     <created>Thursday, June 4, 2015 - 17:37</created>
     <type>Article</type>
     <field_geoposition>Geolocation is 45.4654219, 9.18592430000001</field_geoposition>
     <path>/Argomentiamo/?q=node/1</path>
   </node>
 </node>

 Fatal error: Uncaught exception 'Exception' with message 'String could not be   parsed as XML' in
  /membri/****/*****/****:50 Stack trace: #0 /membri/****/*****/****(50): SimpleXMLElement->__construct('<code><span sty...') #1 /membri/****/*****/****(101): xmlToArel() #2 {main} thrown in /membri//****/*****/**** on line 50

but if i replace the $xmldata with his output in the SimpleXMLElement function , like this:

echo $xmldata;

 $nodes = new SimpleXMLElement( '<?xml version="1.0" encoding="utf-8"?>
 <node>
   <node>
     <title>CONTENT DI PROVA</title>
     <body>CIAO CIAO
     </body>
     <created>Thursday, June 4, 2015 - 17:37</created>
     <type>Article</type>
     <field_geoposition>Geolocation is 45.4654219, 9.18592430000001</field_geoposition>
     <path>/Argomentiamo/?q=node/1</path>
   </node>
 </node>'/*$xmldata*/);

i have no error...

EDIT: maybe the problem is that i use highlight_string to keep my xml:

 $ch = curl_init($xmlsource); 
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
 $sorgente = curl_exec($ch); 
 curl_close($ch);
 $xmldata = highlight_string($sorgente,true); 

Someone can help me?

I see this part of your error message: SimpleXMLElement->__construct('<code><span sty...')

With this I can see that you have HTML code in your xml, and I guess it's for styling. Remove that from the XML, and it should work.

Tip: don't use echo, but var_dump for output while debugging. You would have seen this.