?
Solved

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

Posted on 2008-10-07
1
Medium Priority
?
224 Views
Last Modified: 2013-11-08
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
Comment
Question by:Juliafrazer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
raja_ind82 earned 1500 total points
ID: 22661402
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question