Reading a XML file
Posted: 15 Mar 2014, 20:56
Hi,
I have to parse a XML file like the below example. First I tried with the Ventuz-Node but that doesn't work properly. The problem is that the number of fields in each entry can be different (like in the example).
With .Net I wrote a small program that works very well, but the code doesn't work in the Ventuz script node because I used an array like this:
struct feed {
private string Vorname;
private string Nachname;
private string Beruf;
private string Hobby;
private string Alter;
}
feed[,] entry;
So, my questions.
1. Is there a trick to do it with the Ventuz xml node?
2. Can I do it with the Ventuz script node if there is a way to output the values of the array?
Regards
Gill
----------------------------------------------------------
XML File
----------------------------------------------------------
<myXML>
<entry>
<field name="Vorname">
Harald
</field>
<field name="Nachname">
Holz
</field>
<field name="Beruf">
Zimmermann
</field>
<field name="Hobby">
Segeln
</field>
<field name="Alter">
32
</field>
</entry>
<entry>
<field name="Vorname">
Dirk
</field>
<field name="Nachname">
Meier
</field>
<field name="Beruf">
Angestellter
</field>
</field>
<field name="Alter">
25
</field>
</entry>
<entry>
<field name="Vorname">
Kai
</field>
<field name="Nachname">
Schlösser
</field>
<field name="Beruf">
Kapitän
</field>
<field name="Hobby">
Angeln
</field>
<field name="Alter">
60
</field>
</entry>
</myXML>
I have to parse a XML file like the below example. First I tried with the Ventuz-Node but that doesn't work properly. The problem is that the number of fields in each entry can be different (like in the example).
With .Net I wrote a small program that works very well, but the code doesn't work in the Ventuz script node because I used an array like this:
struct feed {
private string Vorname;
private string Nachname;
private string Beruf;
private string Hobby;
private string Alter;
}
feed[,] entry;
So, my questions.
1. Is there a trick to do it with the Ventuz xml node?
2. Can I do it with the Ventuz script node if there is a way to output the values of the array?
Regards
Gill
----------------------------------------------------------
XML File
----------------------------------------------------------
<myXML>
<entry>
<field name="Vorname">
Harald
</field>
<field name="Nachname">
Holz
</field>
<field name="Beruf">
Zimmermann
</field>
<field name="Hobby">
Segeln
</field>
<field name="Alter">
32
</field>
</entry>
<entry>
<field name="Vorname">
Dirk
</field>
<field name="Nachname">
Meier
</field>
<field name="Beruf">
Angestellter
</field>
</field>
<field name="Alter">
25
</field>
</entry>
<entry>
<field name="Vorname">
Kai
</field>
<field name="Nachname">
Schlösser
</field>
<field name="Beruf">
Kapitän
</field>
<field name="Hobby">
Angeln
</field>
<field name="Alter">
60
</field>
</entry>
</myXML>