XML file from list

lucdrb

Active Member
Licensed User
Longtime User
HI,

I would like to make a XML file from a list.

my XML file should be like that:

<?version = 1.0 encoding = "UTF_8"?>
<liste>
<depot date= "date">
<article>NomArticle</article>
<article>NomArticle</article>
.....
</depot>
</liste>

The program make the list from 1 the multiple line of article for a specific date.
Each day it makes a new list that have to be add to the old one.
I've seen how to parse the XMlFile with XmlSax to retrieve the file.

I know that I can made a XML file from scratch but I would like to know how to make it with XML builder (add the new lines to the old one).
with a for next loop ? how?

Thanks in advance

Luc
 
OK, that's what I thought, but I don't see how to create the file with XMLBuilder and an unknown number of elements ?

thanks
Luc
 
Upvote 0
Here is an example:
Code: Copy
Sub Activity_Create(FirstTime As Boolean)
  Dim x As XMLBuilder
    x = x.create("list")
      x = x.e("depot").a("date", "date")
   For i = 1 To 10
      x = x.e("article").text("Item #" & i).up
   Next
   x = x.up
   x = x.up
    Dim props As Map
    props.Initialize
    props.Put("indent", "yes")
    Log(x.asString2(props))
End Sub
 
Upvote 0
when i use the following code:

Code: Copy
    Dim props As Map
    props.Initialize
    props.Put("indent", "yes")
    Return x.asString2(props)

(with x being my xmlbuilder variable)

and save x to a file, the data is NOT indented. what determines where the indentations are/should be?
 
Upvote 0
Back
Top