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?