simplexml_load_string

(no version information, might be only in CVS)

simplexml_load_string --  Convertit un chaîne XML en objet.

Description

object simplexml_element simplexml_load_string ( string data)

Cette fonction convertit la chaîne XML data en objet possédant des propriétés contenant les données de la chaîne. En cas d'erreurs, cette fonction retourne FALSE.

Exemple 1. Convertir une chaîne XML

<?php
$string
= <<<XML
<?xml version='1.0'?>
<document>
<title>Forty What?</title>
<from>Joe</from>
<to>Jane</to>
<body>
  I know that's the answer -- but what's the question?
</body>
</document>
XML;

$xml = simplexml_load_string($string)

var_dump($xml);
?>

Ce script affichera :

simplexml_element Object
(
  [title] => Forty What?
  [from] => Joe
  [to] => Jane
  [body] =>
   I know that's the answer -- but what's the question?
)

A partir de là, vous pouvez utiliser $xml->body et tout autre élément.

Voir aussi simplexml_load_file().