Solved

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

Posted on 2008-10-07
1
213 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 500 total points
ID: 22661402
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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.

732 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