Root Element Missing Error

Joined
Jun 18, 2006
Messages
23
Programming Experience
3-5
My first question is: When you create a new file in the UserAppDataPath location during DEBUG, where is the file created? I looked through the project's locations/folders and could not find the XML file I created with this code.

Now, onto this error.

My xml structure is the standard xml header and then the root node is:

<tree>
...misc node elements here
</tree>

VB.NET:
If My.Computer.FileSystem.GetFileInfo(Application.UserAppDataPath.ToString & "\UserOptions.xml").Exists = True Then
            'open file and read data
            Try
                Dim reader1 As New XmlTextReader(Application.UserAppDataPath.ToString & "\UserOptions.xml")
                reader1.WhitespaceHandling = WhitespaceHandling.None
                While reader1.Read() '<> False

                    If reader1.NodeType = XmlNodeType.Element Or reader1.NodeType = XmlNodeType.Text Then

                        If reader1.Name = "options" Then
                            'reader.Read()
                            'MessageBox.Show("options element found")
                        ElseIf reader1.Name = "stayontop" Then
                            'reader.Read()
                            'MessageBox.Show("stay on top element found")
                            keepMainOnTop = reader1.ReadString
                        ElseIf reader1.Name = "UserNameColor" Then
                            userNameColor = Color.FromArgb(reader1.ReadString)
                        ElseIf reader1.Name = "CategoryColor" Then
                            categoryColor = Color.FromArgb(reader1.ReadString)
                        End If

                    End If

                End While
                reader1.Close()
            Catch ex As XmlException
                MessageBox.Show(ex.Message)
                
            End Try
        Else
            File.Create(Application.UserAppDataPath.ToString & "\UserOptions.xml")
            optionsDNE = True

        End If

I believe that <tree> is the root node. Is that correct?

How do I remedy this?
 
Back
Top