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:
Private Sub Command2_Click() 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 mp3path = "C:\Program Files\mgamerz\my_images\" f2 = FreeFile Open mp3path & "mp3.txt" For Output As #f2 ' if you don't need mp3.txt take out f1 = FreeFile Open mp3path & "slides.xml" For Output As #f1 Print #f1, "<?xml version=""1.0""?>" Print #f1, "<images>" Print #f1, "<pic>" songname = Dir(mp3path & "\*.jpg") ' get first track i = 1 While Not Len(songname) = 0 MyPath = Right(mp3path, (Len(mp3path) - Len(xmlpath) + 1)) & " " & songname songpath = "<song path=""" & MyPath & """ artist=""" & Artist & """ title=""" & songname & """/> " Print #f1, songpath Print #f2, songname ' for mp3.txt Sleep 100 ' slight pause, needed songname = Dir ' get next track Wend Print #f1, "</pic>" Print #f1, "</images>" Close End Sub
hope someon can shed some light
thanks in advance
R




Reply With Quote