I want to write an XML file in the following format
<?xml version="1.0" encoding="utf-8" ?>
<trans>
<trans eng="string from listbox1" type="string from listbox2"/>
<trans eng="string from listbox1" type="string from listbox2"/>
<trans eng="string from listbox1" type="string from listbox2"/>
<trans eng="string from listbox1" type="string from listbox2"/>
<trans eng="string from listbox1" type="string from listbox2"/>
<trans eng="string from listbox1" type="string from listbox2"/>
<trans eng="string from listbox1" type="string from listbox2"/>
<trans eng="string from listbox1" type="string from listbox2"/>
</trans>
I used the following code but the layout is not as above
Dim settings As XmlWriterSettings = New XmlWriterSettings()
settings.Indent = True
Using writer As XmlWriter = XmlWriter.Create("D:\Translations", settings)
' Begin writing.
writer.WriteStartDocument()
writer.WriteStartElement("trans")
For i = 0 To ListBox1.Items.Count - 1
writer.WriteElementString("eng", ListBox1.Items(i))
writer.WriteElementString("type", ListBox2.Items(i))
Next
writer.WriteEndElement()
End Using
Using the above code I get the XML file as such
<?xml version="1.0" encoding="utf-8"?>
<trans>
<eng>string</eng>
<type>string</type>
<eng>string</eng>
<type>string</type>
<eng>string</eng>
<type>string</type>
<eng>string</eng>
<type>string</type>
</trans>