[SimpleXML] Problème de chargement
Bonsoir,
Je tente de charger un XML venant d'un fichier dans un objet,
Voici mon code de chargement
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
class DAO
{
private $datasource;
function __construct()
{
$fileName = "structure.xml";
$source = file_get_contents($fileName);
echo ("SOURCE \n" . $source);
$this->datasource = simplexml_load_string($source);
if( $datasource == FALSE ) die("Unable to load data source !");
}
........
} |
Le echo m'affiche bien mon XML mais à chaque fois simplexml_load_string($source); me retourne FALSE ?
Ce n'est pas la première fois que je l'utilise cette API mais c'est la premièire fois qu'elle me fait ce type d'erreur ???
Voici le XML
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
<?xml version='1.0' encoding='utf-8' standalone='yes'?>
<structure>
<!--Partner links informations-->
<partners>
<partner name="DomTest" display="false" img="/img/dom.jpg" url="http://www.wanadoo.fr" />
<partner name="MimiTest" display="true" img="/img/mimi.jpg" url="http://www.tf1.fr" />
</partners>
<!--Section files informations-->
<sections>
<section name="mySection1" private="true">
<file name="FILE1" type="video" url="/files/toto.txt" />
<file name="FILE2" type="photo" url="/files/toto2.txt" />
<file name="FILE3" type="video" url="/files/toto3.txt" />
<file name="FILE4" type="photo" url="/files/toto4.txt" />
</section>
<section name="mySection2" private="false">
<file name="FILE2" type="photo" url="/file/ph2.gif" />
<file name="FILE3" type="photo" url="/file/ph3.gif" />
<file name="FILE1" type="video" url="/files/toto.txt" />
<file name="FILE3" type="video" url="/files/toto3.txt" />
</section>
</sections>
</structure> |
Merci d'avance pour votre aide :wink:
Dominique