Bonjour,

je vais récupérer des fichiers xml créé automatiquement sur mon serveur et je voudrai les traiter pour les transformer en HTML.
pour cela j'aimerai utiliser Xml Reader.
j'ai un fichier Xml qui pourrait avoir cette structure :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<phr type="DP" function="SUJ0" n="0">
         <w type="det" lemma="le">Le</w>
         <w type="adj" lemma="joli">joli</w>
         <w type="nom" lemma="chat">chat</w>
 
         <phr type="" function="DO1" n="1">
            <w type="pro" lemma="que">que</w>
         </phr>
 
         <phr type="" function="SUJ1" n="1">
            <w type="nom" lemma="je">j'</w>
         </phr>
 
         <phr type="" function="GV1" n="1">
            <w type="aux" lemma="avoir">ai</w>
            <phr type="" function="CC2" n="2">
               <w type="adv" lemma="gentiment">gentiment</w>
            </phr>
            <w type="partpass" lemma="adopter">adopté</w>
         </phr>
      </phr>
je voudrai le traiter et obtenir cela :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<span class="SUJ0">
        <span class="det" title="Déterminant défini - Masculin Singulier">le</span>
        <span class="adj" title="Adjectif - Masculin Singulier">joli</span>
        <span class="nom" title="Nom Commun - Masculin Singulier">chat</span>
<span class="DO1">
   <span class="pro" title="Pronom Relatif - Singulier Masculin">que</span>
</span>
<span class="SUJ1">
   <span class="nom" title="Pronom Personnel - 1ère Personne Singulier">j'</span>
</span>
 <span class="GV1">
  <span class="aux" title="Verbe Auxiliaire - Indicatif 1ère Personne Singulier">ai</span>
  <span class="CC2">
        <span class="adv" title="Adverbe">gentiment</span> </span>
        <span class="partpass" title="Verbe - Participe Passé">adopté</span>
</span>
</span>

pour le moment je n'arrive qu'à afficher les differents contenu des noeud
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
 
<?php
 
 
 
$xmlReader = new XMLReader();
$xmlReader->open('xml-adhoc/test.xml');
echo '<span>';
while ($xmlReader->read())
{
$nom = ($xmlReader->name);
$valeur = ($xmlReader->value);
$type = ($xmlReader->nodeType);