943,923 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 1065
  • VB.NET RSS
Jan 6th, 2009
0

Append Node to existiing XML file Using Vb.net

Expand Post »
Dear fiends,

Am Posting a Lot Nowadays.. Sorry if i had Disturbed you all...Hera my XML file..i Have to append a node below this..can some give me any idea how to do it..When i try..it is over writing the file

i need to append

<TaskName>
<name>abc</name>
<Value>3454</Value>
</TaskName>

following to the below code...can some one help me..with vb.net 1.1

<?xml version="1.0" encoding="UTF-8"?>
<TaskDetails>
<TaskName>
<name>qwerty</name>
<Value>12345</Value>
</TaskName>
</TaskDetails>
Reputation Points: 18
Solved Threads: 0
Light Poster
jaiprakash15 is offline Offline
27 posts
since Nov 2008
Jan 7th, 2009
0

Re: Append Node to existiing XML file Using Vb.net

Hi all..

I have Solved this Thread By Myself..Here is the code if some one needs..


Public Sub xmlAppend(ByVal TaskId As String, ByVal Status As String)
Dim Tskid, stats As String
Tskid = TaskId.ToString.Trim
stats = Status.ToString.Trim
Dim myDoc As Xml.XmlDocument = New Xml.XmlDocument
myDoc.Load("d:\final.xml")
Dim root As XmlNode = myDoc.DocumentElement
Dim myElement As XmlElement = myDoc.CreateElement("Task")
Dim myName As XmlElement = myDoc.CreateElement("Name")
myName.InnerText = Tskid
Dim myString As XmlElement = myDoc.CreateElement("Satus")
myString.InnerText = stats
root.AppendChild(myElement)
myElement.AppendChild(myName)
myElement.AppendChild(myString)
myDoc.Save("d:\final.xml")
MsgBox("Xml File GeneratedUpdated")
End Sub
Reputation Points: 18
Solved Threads: 0
Light Poster
jaiprakash15 is offline Offline
27 posts
since Nov 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: How do I play a .wav file from Resources?
Next Thread in VB.NET Forum Timeline: how to change file name?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC