ebbinger_413
Member
- Joined
- Apr 11, 2008
- Messages
- 6
- Programming Experience
- 1-3
I have been working on a medium scale program for the nds-scene for some time now. I had the first version completed and was created in vb.net 2003 and working perfectly. I am now in the process of updating the program to .net 2.0 and am using vs 2005. The old version had a backup feature which would backup a listview control to a simple ascii text file.
I am changing the backup file to an xml file now and am using the following code to do so:
I am looking to get an output similar to below:
But i am getting the following error:
Token StartElement in state Epilog would result in an invalid XML document.
This is the first time I am using vb to write xml so there might be something im doing wrong, but from every site or book ive seen around it looks to be correctly codded. I also could not find anything as to this error in regards to xml with vb online anywhere.
- Please help !!!
I am changing the backup file to an xml file now and am using the following code to do so:
VB.NET:
' show the export dialog for user to choose a location to save the backup
dlg_export.ShowDialog()
Dim export As XmlTextWriter = New XmlTextWriter(dlg_export.FileName, System.Text.Encoding.UTF8)
export.WriteStartDocument()
export.Formatting = Formatting.Indented
export.Indentation = 4
export.WriteDocType("HomebrewManagerBackup", Nothing, Nothing, Nothing)
export.WriteComment("Created on: " & Now())
For Each item As ListViewItem In lst_main.Items
export.WriteStartElement("Item")
For Each subitem As ListViewItem.ListViewSubItem In item.SubItems
export.WriteElementString("Subitem", subitem.Text)
Next
export.WriteEndElement()
Next
export.WriteElementString("MOTD", My.Settings.motd_message)
export.WriteEndDocument()
export.Close()
I am looking to get an output similar to below:
VB.NET:
<?xml version=1? encoding=utf-8>
<doctype homebrewmanagerbackup>
<--created on dateandtimehere-->
<item>
<subitem></subitem>
</item>
<motd></motd>
But i am getting the following error:
Token StartElement in state Epilog would result in an invalid XML document.
This is the first time I am using vb to write xml so there might be something im doing wrong, but from every site or book ive seen around it looks to be correctly codded. I also could not find anything as to this error in regards to xml with vb online anywhere.
- Please help !!!