Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2004, 07:19 AM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to insert a new element in XML file?

Hi all,

Let say I have the following XML file:


<?xml version="1.0" ?>
<Store>

<cdCollect>
    <cd id="1">
        <title>Latest Hits</title>
        <price>17.3</price>
    </cd>
</cdCollect>

<Books>
    <book id = "1">
        <title>ASP.NET</title>
        <isbn>121212</isbn>
        <price>32.65</price>
    </book>
    <book id = "2">
        <title>Visual C#</title>
        <isbn>4433434</isbn>
        <price>56.32</price>
    </book>
    <book id = "3">
        <title>ADO.NET</title>
        <isbn>43434</isbn>
        <price>55.65<.price>
    </book>
</Books>

</Store>


Now, how can I do the following by using C#:

1. How to insert a new element with child nodes as shown below under <Books>...</Books>? :
    <book id = "4">
        <title>XML Bible</title>
        <isbn>77676</isbn>
        <price>85.65</price>
    </book>


Thank you,

Your help is very very much appreciated.

Regards,

Samir


 
Old September 20th, 2004, 09:18 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello Samir,
Take a look at this
http://p2p.wrox.com/topic.asp?TOPIC_ID=18763
it should help you,if not ask again.

--------------------------------------------
Mehdi.:)





Similar Threads
Thread Thread Starter Forum Replies Last Post
append/insert data to xml file andhiez XML 5 April 18th, 2008 11:13 AM
insert in xsl template some xml file ratzko XSLT 2 January 16th, 2008 08:30 AM
how to insert one xml file into another as an elem sushant raut XSLT 5 December 21st, 2007 01:04 AM
Getting value of an element in an XML file semilemon C# 2005 5 April 13th, 2007 07:54 AM
Adding an Element with Attribute to XML file xergic Classic ASP XML 0 November 20th, 2004 08:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.