RSS Forums RSS

Append Node to existiing XML file Using Vb.net

Please support our VB.NET advertiser: DiscountASP.NET – 3 Months Free on VB.NET Web Hosting
Thread Solved
Reply
Posts: 26
Reputation: jaiprakash15 is an unknown quantity at this point 
Solved Threads: 0
jaiprakash15 jaiprakash15 is offline Offline
Light Poster

Append Node to existiing XML file Using Vb.net

  #1  
Jan 6th, 2009
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>
AddThis Social Bookmark Button
Reply With Quote  
Posts: 26
Reputation: jaiprakash15 is an unknown quantity at this point 
Solved Threads: 0
jaiprakash15 jaiprakash15 is offline Offline
Light Poster

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

  #2  
Jan 6th, 2009
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the VB.NET Forum
Views: 459 | Replies: 1 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:00 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC