Results 1 to 2 of 2

Thread: VB and xml help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    VB and xml help

    Hi all,

    I got a vas t amount of information from here on my last project and cant thatnk those enough who helped. I am hoping for a little bit more.

    I had some code that would write an xml file from the contents of a folder and this project is similar but the xml file is a bit different.

    this is the code I am using to write the xml file currently

    VB Code:
    1. Private Sub Command2_Click()
    2.  
    3.  
    4.     Dim f1 As Integer, songname As String, songpath As String, mp3path As String, f2 As Integer, i As Integer
    5.    
    6.    
    7.     mp3path = "C:\PROGRAM FILES\Image text Editor\photos\"
    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 & "audiolist.xml" For Output As #f1
    14.     Print #f1, "<?xml version=""1.0""?>"
    15.     Print #f1, "<slides>"
    16.     songname = Dir(mp3path & "\*.jpg")   ' get first track
    17.     i = 1
    18.     While Not Len(songname) = 0
    19.         songpath = "<slidenode jpegURL=""" & mp3path & songname & """ title=""" & songname & """/> "
    20.         Print #f1, songpath
    21.         Print #f2, songname                  ' for mp3.txt
    22.         Sleep 100                                ' slight pause, needed
    23.         songname = Dir                         ' get next track
    24.    
    25.     Wend
    26.     Print #f1, "</slides>"
    27.  
    28.  
    29. Close
    30. End Sub

    I am trying to adapt this code to write the xml file like this

    <?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <slides>

    <slideNode jpegURL="photos/marylin.jpg">dokie</slideNode>
    <slideNode jpegURL="photos/ragingwater.jpg">okie</slideNode>
    </slides>

    hope someone can help.

    thanks in advance
    Rob

  2. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: VB and xml help

    You can read and write xml files, check out the links:

    XML Handling - Create XML
    XML Handling - Append Child Element
    XML Handling - Read XML
    CS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width