stò usando questo codice per generare un file xml strutturato in questo modo, il file mi viene generato ad eccezione del fatto che mi ristituisce una linea in più, cosa che mi genera un problema, come posso eliminare questo problema,
il codice è questo
è questo è quello che mi viene generato, in rosso quello che dovrei eliminare:codice:Dim path As String = Application.StartupPath + "\DB\dati.xml" If File.Exists(path) Then File.Delete(path) End If Dim sw As StreamWriter = New StreamWriter(path) sw.WriteLine("<?xml version=""1.0"" encoding=""utf-8"" standalone=""yes""?>") sw.WriteLine("<images>") sw.WriteLine("<thumb displayNum=""7"" separation=""2"">") For i As Int32 = 0 To FileListBox1.Items.Count - 1 sw.WriteLine("<image>images/" + FileListBox1.Items(i.ToString) + "</image>") sw.WriteLine("<description>0</description>") sw.WriteLine("</thumb>") sw.WriteLine("<thumb>") Next sw.WriteLine("</images>") sw.Close()
codice:<?xml version="1.0" encoding="utf-8" standalone="yes"?> <images> <thumb displayNum="7" separation="2"> <image>images/IMGP0566.JPG</image> <description>0</description> </thumb> <thumb> <image>images/IMGP0567.JPG</image> <description>0</description> </thumb> <thumb> <image>images/IMGP05671.JPG</image> <description>0</description> </thumb> <thumb> <image>images/IMGP0568.JPG</image> <description>0</description> </thumb> <thumb> <image>images/IMGP0569.JPG</image> <description>0</description> </thumb> <thumb> <image>images/IMGP05691.JPG</image> <description>0</description> </thumb> <thumb> <image>images/IMGP0570.JPG</image> <description>0</description> </thumb> <thumb> </images>

Rispondi quotando