Solved

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

Posted on 2008-10-07
1
201 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
1 Comment
 
LVL 14

Accepted Solution

by:
raja_ind82 earned 500 total points
ID: 22661402
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Object to array 7 28
VB.net PaintEventArgs Handling. 10 27
Problem to go to Web page 2 52
AutoHotkey ActiveX Component Error 8 55
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now