I need some help with this one. Ok, I want to create an xml file of all my mp3 files on my home pc.:S

I am using the code as follows:-

Public Class Form1
  Dim myWriter As New System.Xml.XmlTextWriter
  myWriter = New System.Xml.XmlTextWriter("C:\music_stuff.xml", Nothing)
 With myWriter
      .Indentation = 4
      .IndentChar = " "
      .Formatting = . Indentation
      .WriteComment ("my freaking music yay")
      .WriteElementString("title","blah blah")
      .WriteElementString("description", "wah wah wah")
 End With
End Class

It gives output something like:-

<?xml version="1.0" ?>
  <!-- my freaking music yay -->
     <description>wah wah wah</description>

And that just works fine for one record, but I want to append to this one file all my mp3s. But I just don't know how to append, well I have an idea but it is long winded. What's gonna be the best way?

9 Years
Discussion Span
Last Post by iamthwee

Hmm...I don't remember if there is a specific way to do it with the code and the objects themselves.

But, in theory, could you read whatever is in the document into a variable, then create the new data and then write it all back in one huge chunk at the end?


I was googling before and came across that same link. But it didn't really help me. I didn't think appending an xml file would be so hard.

Argh, I might even have to write my own api.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.