« Programmation PHP/Exemples/DomXml » : différence entre les versions

Contenu supprimé Contenu ajouté
Tavernierbot (discussion | contributions)
Ligne 11 :
== Écriture d'un xml complexe ==
 
* Écriture d'un xmldocument XML valide à imbrications multiples aux tagsd'éléments hétéroclites comportant des attributs ou non...
 
<source lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<root>
<tag1 m1="attTag1" m2="att2">
<sous-tag1>texte sous-tag1
<sous-tag2></sous-tag2>
texte tag1
</sous-tag1>
</tag1>
<tag1>
<sous-tag1>texte sous-tag1
<sous-tag2 att1="att2" att3="att3"></sous-tag2>
</sous-tag1>
<tag3>
<sous-tag1>texte sous-tag1
<sous-tag2></sous-tag2 att1="attribut1"></sous-tag1tag2>
</sous-tag1>
<etEncoreUnTagSuperflu>
<sous-tag1>texte sous-tag1
<sous-tag2>test</sous-tag2>
</sous-tag1>
<tag1>
<p><b><sous-tag1>texte sous-tag1
<sous-tag2 att1="attribut1" /></b>
</sous-tag1>
ceci</p>est du body texte à extraire
</tag1>