Inserting values in XML

Posted by Shoyebaziz123 under ASP.NET on 10/9/2009 | Views : 1265 | Status : [Member] | Replies : 3
Hi All,
I have write this xml

<?xml version="1.0" encoding="utf-8" ?>
<NewDataSet2>
<authors>
<First_Name>A</First_Name>
<Middle_Name> Ahmad </Middle_Name>
<Last_Name>Shoyeb</Last_Name>
<Pan_No>9890118124</Pan_No>
</authors>
<authors>
<First_Name>B</First_Name>
<Middle_Name> Ahmad </Middle_Name>
<Last_Name>Shoyeb</Last_Name>
<Pan_No>9890118124</Pan_No>
</authors>
<authors>
<First_Name>F</First_Name>
<Middle_Name> Ahmad </Middle_Name>
<Last_Name>Shoyeb</Last_Name>
<Pan_No>9890118124</Pan_No>
</authors>
<authors>
<First_Name>G</First_Name>
<Middle_Name> Ahmad </Middle_Name>
<Last_Name>Shoyeb</Last_Name>
<Pan_No>9890118124</Pan_No>
</authors>
</NewDataSet2>

now how can i insert more value in this xml at run time
Thanks in advance.




Responses

Posted by: Vuyiswamb on: 10/9/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Day

Look at this

http://www.example-code.com/csharp/csXmlAddRecord.asp

http://social.msdn.microsoft.com/Forums/en-US/linqprojectgeneral/thread/c863ea72-3215-4c2b-9fb5-215548675e8f

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh4u on: 10/10/2009 [Member] Bronze

Up
0
Down
Hi
Pls Follow Below Links
http://www.dotnetfunda.com/codes/code354-write-birth-day-in-existing-in-xml.aspx
http://www.dotnetfunda.com/codes/code355-create-and-write-birthday-details-in-xml.aspx

Santosh
Bangalore

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Tridev_2005 on: 10/12/2009 [Member] Starter

Up
0
Down
Use LINQ you can also insert value in XML



doc.Element("Store")
.Elements("Customers")
.Elements("Customer")
.Where(t => t.Element("CustomerID").Value == "1")
.Elements("Purchases")
.Elements("Item")
.Where(t => t.Attribute("ID").Value == "1")
.Single()
.Add(purchase);


Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response