Hi all,

I was around here a while back and received some excellent help and advice and was hoping for a bit more, what it is I am trying to write an xml file in VB.

I need to get the xml file like this
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<photo>
<image>my_images\1.jpg</image>
</photo>
<photo>
<image>my_images\logos.jpg</image>
</photo>
</images>

but I can only get it like this

<?xml version="1.0"?>
<images>
<pic>
<song path="C:\Program Files\mgamerz\my_images\ 116941_4039.jpg" artist="" title="116941_4039.jpg"/>
<song path="C:\Program Files\mgamerz\my_images\ logos2.jpg" artist="" title="logos2.jpg"/>
<song path="C:\Program Files\mgamerz\my_images\ victorian_christmas2a.jpg" artist="" title="victorian_christmas2a.jpg"/>
</pic>
</images>

the reason why the naming is different is because I am using an old app I made for adding mp3 files and was just wondering what I need to change to acheive the xml formatting.

heres my code if it helps

VB Code:
  1. Private Sub Command2_Click()
  2.  
  3.  
  4.     Dim f1 As Integer, jpgurl As String, MyPath As String, Artist As String, xmlpath As String, songpath As String, slidenode As String, songname As String, mp3path As String, f2 As Integer, i As Integer
  5.    
  6.    
  7.     mp3path = "C:\Program Files\mgamerz\my_images\"
  8.    
  9.      f2 = FreeFile
  10.     Open mp3path & "mp3.txt" For Output As #f2       ' if you don't need mp3.txt take out
  11.      f1 = FreeFile
  12.      
  13.     Open mp3path & "slides.xml" For Output As #f1
  14.     Print #f1, "<?xml version=""1.0""?>"
  15.     Print #f1, "<images>"
  16.     Print #f1, "<pic>"
  17.     songname = Dir(mp3path & "\*.jpg")   ' get first track
  18.     i = 1
  19.     While Not Len(songname) = 0
  20.         MyPath = Right(mp3path, (Len(mp3path) - Len(xmlpath) + 1)) & " " & songname
  21.        
  22.        songpath = "<song path=""" & MyPath & """ artist=""" & Artist & """ title=""" & songname & """/> "
  23.         Print #f1, songpath
  24.         Print #f2, songname                  ' for mp3.txt
  25.         Sleep 100                                ' slight pause, needed
  26.         songname = Dir                         ' get next track
  27.    
  28.     Wend
  29.     Print #f1, "</pic>"
  30.     Print #f1, "</images>"
  31.  
  32.  
  33. Close
  34. End Sub

hope someon can shed some light

thanks in advance
R