[REBOL] XML Parsing ????
From: vbegin:webbyzz at: 20-Dec-2002 17:45
Hi Everybody !
Does anyone knows how to traverse a complex xml structure? By complex I mean with muliple
attributes for each element. I'm pretty knew to Rebol and I have no idea why it's not
working. I've downloaded the parse-xml+ by Gavin McKenzie, it seems to work perfectly
with a simple xml structure but not with a complex one like:
this xml
<paragraphes>
<paragraphe no="7" type="wbformulaire_" name="item formulaire">
<item id="table1debut" type="1" position="1" data="0">
<label></label>
<value></value>
</item>
<item id="table1titre" type="2" position="2" data="0">
<label></label>
<value></value>
<properties>
<property name="class">s</property>
<property name="bgcolor">#dbeaf5</property>
</properties>
</item>
<item id="table1fin" type="3" position="3" data="0">
<label></label>
<value></value>
</item>
<item id="table2debut" type="1" position="4" data="0">
<label></label>
<value></value>
</item>
<item id="wbformulaire_" type="2" position="5" data="1">
<label>Paragraphe - Formulaire</label>
<value></value>
<properties>
<property name="class">s</property>
<property name="bgcolor">#dbeaf5</property>
</properties>
</item>
<item id="xtype" type="5" position="6" data="1">
<label>Type</label>
<value></value>
<choices>
<choice name="text">Texte 1 ligne</choice>
<choice name="button">Bouton</choice>
<choice name="select">Liste</choice>
<choice name="textarea">Texte multiple ligne</choice>
<choice name="hidden">Caché</choice>
<choice name="password">Mot de passe</choice>
</choices>
</item>
<item id="xlabel" type="6" position="7" data="1">
<label>Libélé</label>
<value></value>
<properties>
<property name="class">s</property>
<property name="size">60</property>
</properties>
</item>
<item id="xprop" type="10" position="8" data="1">
<label>Propriétes</label>
<value></value>
<properties>
<property name="class">s</property>
<property name="rows">10</property>
<property name="cols">60</property>
</properties>
</item>
<item id="xval" type="7" position="9" data="1">
<label>Valeur(Séparer les valeurs par ...)</label>
<value></value>
<properties>
<property name="class">s</property>
<property name="rows">10</property>
<property name="cols">60</property>
</properties>
</item>
<item id="table2fin" type="3" position="10" data="0">
<label></label>
<value></value>
</item>
</paragraphe>
the output that the parse gives me:
paragraphe no 7 type wbformulaire_ name item formulaire
item id table1debut type 1 position 1 data 0
label none none
value none none
item id table1titre type 2 position 2 data 0
label none none
value none none
properties none
property name class s
property name bgcolor #dbeaf5
item id table1fin type 3 position 3 data 0
label none none
value none none
item id table2debut type 1 position 4 data 0
label none none
value none none
item id wbformulaire_ type 2 position 5 data 1
label none Paragraphe - Formulaire
value none none
properties none
property name class s
property name bgcolor #dbeaf5
item id xtype type 5 position 6 data 1
label none Type
value none none
choices none
choice name text Texte 1 ligne
choice name button Bouton
choice name select Liste
choice name textarea Texte multiple ligne
choice name hidden Caché
choice name password Mot de passe
item id xlabel type 6 position 7 data 1
label none Libélé
value none none
properties none
property name class s
property name size 60
item id xprop type 10 position 8 data 1
label none Propriétes
value none none
properties none
property name class s
property name rows 10
property name cols 60
item id xval type 7 position 9 data 1
label none Valeur(Séparer les valeurs par ...)
value none none
properties none
property name class s
property name rows 10
property name cols 60
item id table2fin type 3 position 10 data 0
label none none
value none none
Let say that I just want to isolate the value of the name attribute. How can I do that?
Thanks a lot for your help !
Nicka