Store a Listbox contents as XML ?


you already understand that I am working with XML since yesterday. The idea is to provide a way to store a Listbox contents as XML in a file (export).

My first attempt works fine, but I was not happy with the XML format (I used Xojo 2015r1 example (League/Team). Before I really started to write the import code, I decided to try some different way.

I search and found a 40 pages document I wrote with REALbasic 5.5.4 (the paper print edition: the original computer file es certainly somewhere in my archives, but where ???). I found there some more pleasant code / Results

At last, I wrote the code (see the result below) as a proof of concept and I wwas more happy with it.
As you can see, basically, I wrote two parts: the heading and the core part (I put only one entry). No data comes from a Listbox (yet): the core of the Listbox contents will be scanned in a loop and written below the second Comment line (the second Person block; in the real life code, I will add the Row number to “Person”, just like: “Person_0”, “Person_1” and so on .

<?xml version="1.0" encoding="UTF-8"?> <Root xmlns:xml=""> <Person> <!-- The first entry is the Column Headings --> <FirstName>John</FirstName> <LastName>Doe</LastName> </Person> <!-- The data below will fill the Listbox Rows / Cells --> <Person> <!-- Contents of Row 0 (all Cells) --> <FirstName>Paul</FirstName> <LastName>Smith</LastName> </Person> </Root>

Nota: I only display two cells (FirstName / LastName), but the idea is to store all Cells of all Rows.

I think I will have less troubles to read this kind of storage than the other code (It store all Cells in a single statement (Row_0 FirstName="Jane" LastName="Estrosi" SpouseName="Doe" and so on…)

Firefox is happy with both xml files.

What is your feeling ?