[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

i need to write to an xml file, from an xml file i have created

Hi,

I am using vb.net to read an xml file with basic user information.  I want to be able to write back to a new xml file, and maybe do some logic like bind firstName and surName elements together.

Any clues of writing, using the elements already obtained from the read function?

Thanks

Julia
Public Sub MigrateFromOldToNew()
      
 
 
        Dim xmlFilePath As String = HttpContext.Current.Server.MapPath("Students.xml")
 
        Try
            Using reader As XmlReader = XmlReader.Create(xmlFilePath)
 
                While (reader.Read)
                    If (reader.NodeType = XmlNodeType.Element) Then
 
                        If (reader.Name = "StudentId") Then
                            studentId = reader.ReadInnerXml
                        End If
 
                        If (reader.Name = "StudentName") Then
                            studentName = reader.ReadInnerXml
                        End If
 
                        If (reader.Name = "StudentSurname") Then
                            studentSurname = reader.ReadInnerXml
                        End If
                    End If
                End While
 
            End Using
        Catch ex As Exception
 
        End Try
 
 
 
 
    End Sub

Open in new window

0
Juliafrazer
Asked:
Juliafrazer
1 Solution

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now