Rapide Advanced Adulte
 
 Web|Image|Shop|Video|News|Wmx|Mobile|Wiki|Ajouter ce moteur

     Manuel PHP     
Partager
 
 
Partager
Partager

 

Table :

.SimpleXMLElement->addAttribute()
.SimpleXMLElement->addChild()
.SimpleXMLElement->asXML()
.SimpleXMLElement->attributes()
.SimpleXMLElement->children()
.SimpleXMLElement-> construct()
.SimpleXMLElement->getDocNamespaces()
.SimpleXMLElement->getName()
.SimpleXMLElement->getNamespaces()
.SimpleXMLElement->registerXPathNamespace()
.SimpleXMLElement->xpath()
.simplexml import dom
.simplexml load file
.simplexml load string
 
   

  simplexml_load_string  


simplexml_load_string

(PHP 5)

simplexml_load_string -- Convertit une chaîne XML en objet

Description

object simplexml_load_string ( string data [, string class_name [, int options [, string ns [, bool is_prefix]]]] )

Convertit la chaîne XML data et retourne un objet de la classe SimpleXMLElement.

Liste de paramètres

data

Une chaîne XML valide

class_name

Vous pouvez utiliser le paramètre optionnel et, ainsi, la fonction simplexml_load_string() retournera un objet de la classe spécifiée. Cette classe doit étendre la classe SimpleXMLElement.

options

Depuis PHP 5.1.0 et Libxml 2.6.0, vous pouvez aussi utiliser le paramètre options pour spécifier des paramètres additionnels Libxml.

ns

is_prefix

Valeurs de retour

Retourne un objet de la classe SimpleXMLElement dont les propriétés contiennent les données du document XML. Si une erreur survient, la fonction retournera FALSE.

Exemples

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);
?>

L'exemple ci-dessus va afficher :

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

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


    Annonces       
 

 Retour au chapitre Php

 

Top
 

Ajouter JungleKey.fr à votre Explorateur

 
 

About Us | © 2007 JungleKey




iBlack | Mobile | Wiki | Ajouter ce moteur
.