How to add a new element in a 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

0
Samir (5)
9/20/2004 2:13:05 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
615 Views

Similar Articles

[PageSpeed] 31

Reply:

Similar Artilces:

Outlook Backup not on File menu
Running Outlook 2007 on Windows7 - home PC not on Exchange. I downloaded the Microsoft Office Personal Folders Backup installer from Microsoft web site, closed Outlook, and then installed Backup. Install looked normal. I started Outlook and clicked on the "File" menu expecting to see "Backup" on the drop-down menu, but it is not there. Control Panel Programs shows the Backup program is installed. Any ideas how to fix? CWR wrote: > Running Outlook 2007 on Windows7 - home PC not on Exchange. I downloaded the > Microsoft Office Personal Folders Bac...

Charting a .csv file in excel 2003
I am trying to chart two columns from a .csv file. In the Chart Wizard. When it gets to the Data Range, the field is blank. So I high lite the two columns again, and try to hit next button. Microsoft excel says, "A formula in this worksheet contains one or more invalid references. Verify that formulas contain a valid path, workbook, range name, and cell reference. It won't chart my data. What should I do? Is it 2003 excel fault? If I try to chart a .xml file with the same steps and it works. Also out of the high lited columns; Data Range field is already filled in corre...

Is there a way of using EM_STREAMIN to load a file into a rich edit control of another application
Greetings!! This is my post to this group, so please make me aware if I don't follow the proper etiquette :-) Question: Is there a way of using EM_STREAMIN to load a file into a rich edit control of another application? What I really need to do: I need to load a file into a RICHEDIT20A control of another application (lets call that application RichTextEditor). The RichTextEditor application does not provide support to "load a file" but does provide support for "copy" and "paste" operations. What I have already tried: A) I have written an MFC dialog applic...

How do I update table with new incrementing ids per each account
I have a table with AcctNo, SecurityName, otherfields. I need to update this table with a new field that would indicate for each AcctNo row the number of SecurityName. for example: ACCTNO NEWFIELD SECURITYNAME 10021 1 IBM 10021 2 SEARS 10022 1 MICROSOFT 10022 2 RIMM 10022 3 GMC Is there a function that can do this? I would appreciate any help. On Tue, 3 Jul 2007 18:00:01 -0700, Jose G Morales <JoseGMorales@discussions.microsoft.com> wrote: >I have a table ...

Pdf File To Excel #2
How To Convert Pdf File Into Excel File. I Am Having Pdf File Which Are Created From Graphs & Want To Covert I Excel Pls Suggest Me Any Link Or Addins Thanks In Advance -- NITESH ----------------------------------------------------------------------- NITESH G's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1759 View this thread: http://www.excelforum.com/showthread.php?threadid=49602 You need to have one of the following, Adobe Acrobat Exchange (5.0) Acrobat Professional (6.0) or Acrobat 7.0. There are some other vendor who make programs which will...

Do you konw HOW TO ADD A ActiveX control developed by MFC in ATL Project
I build a activeX control using MFC, and now, I won't insert it in a ATL project without creating a window for containing the control.I ever did it as a COM, but I only can get the interface point, I can't using interface function defined in the control.Did anybody know how to make the control fine??????????????????????? In your MFC control override IsInvokeAllowed( DISPID) and return TRUE. ----- HongHan wrote: ----- I build a activeX control using MFC, and now, I won't insert it in a ATL project without creating a window for containing the control.I e...

error adding new schema field 05-24-04
Hi, When I attempt to add a new schema field to an account in the Deployment Manager, I get the following error: "An error occured during the addition of the new field. The addition failed." In the event log, there were 2 entries: "dmlog:sp_repladdcolumn failed-timeout expired" "dmlog:failed to add new integer attribute (CFInumberofpcs) to Account Entity. Anyone got any ideas how to resolve this? Try the following recommendation from the Microsoft website SYMPTOM When you create a new schema field in Microsoft® Business Solutions CRM (Microsoft CRM) Deplo...

how to open pcx files
can anyone help me out to open pcx file in ms outlook2003 ...

missing files #2
I opened a floppy disc this morning, the computer crashed and now I can't get anything of the disc, please can anyone help? Hi Poppy (what a lovely name), you could try Windows check disk. Go into My Computer, find your floppy drive (usually A:) - right clic on this (with the floppy disk in there) and select Properties, the Tools, under Error Checking click Check Now, tick both boxes and clic Start. If a drive or file is being accessed while a computer crashes i usually causes corruption. The disk scan will attempt to fix an corruption which might have occured. If this does not work...

downloaded file
A CSV file that I download would previously open full screen. Now it opens in a small screen. Is this something I can get back or is it a function of the sender? SG ...

swf flash file embedded in html file which is edited in excel.. he
Hi, I have an html file which has an swf flash movie embedded in it. When I open it in excel, it works fine and the movie is viewable. However, when I want to send it out as an email, everything but the embedded swf is viewable, i.e. where the swf should be instead there is a blank white space! And yet when viewing the html file through a browser (IE6) it is perfectly fine. Here's the affected code - as rewritten by excel... <tr height=17 style='height:12.75pt'> <td height=17 class=xl26 width=19 style='height:12.75pt;width:14pt'><!--[if gte vml 1]>...

linked files
When I open a file it says it is linked to another file. When I check the links it is linked to a file I no longer have. How do I find where the link is coming from and get rid of it. Going to the Edit Links doesn't seem to get rid of the file. Charlie C Try Bill Manville's excellent "FindLink" utility .. It's available at Stephen Bullen's page: http://www.oaltd.co.uk/MVP/Def�ault.htm -- Rgds Max xl 97 --- GMT+8, 1� 22' N 103� 45' E xdemechanik <at>yahoo<dot>com ---- "Charlie 5280" <Charlie 5280@discussions.microsoft.com>...

Can not open file
I have a workbook which I built with vlookups and charts. When I went back today to open it it starts to open then asks if I would like to enable/disable macros. I have done both enable and disable after I hit the button it closes excel down completely. It only does this with this file? Hi sounds like a corrupted file. You may try using OpenOffice (seems to be able to open such files): www.openoffice.org -- Regards Frank Kabel Frankfurt, Germany "Pat Quinn" <pquinn@biolabinc.com> schrieb im Newsbeitrag news:a34001c4d6fa$16da9b90$a401280a@phx.gbl... > I have a workbo...

Can excel files be opened in fixed screen size preset by user?
Can excel files be opened in fixed screen size preset by user? Can the window size be set by the user. So that the next time excel opens it would open to the custom settings set by the user. The custom settings can be changed by the user? Excel remembers the last window size it used so if Excel is closed down with the window on screen being eg 5cm x 10cm, it will open the next time at the same size. -- Ian -- "vabraham" <vabraham@discussions.microsoft.com> wrote in message news:9F0ED136-FC3E-45C7-9966-D2304820FB09@microsoft.com... > Can excel files be opened in fixe...

Help / tutorials for user who is new to CRM
I am new to CRM. I have a service business (no product) that I would like to use CRM to track (past & future) appointments and other work done for clients, work performed vs. billed, and report on overall time spent and allocated. I have browsed through some of the online information, installed the software, created clients and contacts and users. Could someone point me to a resource that can walk me through the basics of using CRM as a newbie? Thank you. You might want to consider attending an instructor led course for Microsoft CRM. ============================== John O'...

Cell truncated to 256 characters during copy to new worksheet
When you copy a cell which has greater than 256 characters from one worksheet to another the cell gets truncated to 256 characters. I have used the workaround suggested in the MS knowledge base. Does anyone else have any ideas? Brad Was the suggestion in the KB to copy the worksheet, then come back and copy the cells, then paste the cells? If it was, then I don't have another suggestion. If it wasn't, then I do. Brad Backlin wrote: > > When you copy a cell which has greater than 256 characters > from one worksheet to another the cell gets truncated to > 256 char...

Permissioins required to give access to a IT user to add/remove mailboxes only
I'm looking for instructions to add the necessary permissions for 1 user (or group) to have the ability to add/remove and configure mailboxes in exchange 2003 (mixed mode). This user needs to mail enable an AD account, change email addresses and configure information on the exchange tabs. Any good documents out there that you can point me to? thanks, FastEddie http://support.microsoft.com/kb/316792 -- Joe Richards Microsoft MVP Windows Server Directory Services www.joeware.net FastEddie wrote: > I'm looking for instructions to add the necessary permissions for 1 user (o...

Opening publisher 03 files in publisher 00
I have been emailed four documents that have been composed in publisher version 2003 but my computer will not open them as I only have publisher version 2000 - is there anyway that I can get these files to open on my computer??? Please help!!!!! KK wrote: > I have been emailed four documents that have been composed in > publisher version 2003 but my computer will not open them as I only > have publisher version 2000 - is there anyway that I can get these > files to open on my computer??? Please help!!!!! ======================================== Ask the sender to save the files ...

Text File problem
I just upgraded from VS 2003. I notice if I try to write a CString to a file it p u t s s p a c e s between the characters in the file. I works fine if I use a character arrary. Is there a way I can use CString. I've tried using CFile and CStdioFile with the same result. Here's quick and dirty code. The commets // are for code that doesn't work. CStdioFile shutfile; CString filid; filid="sdown.cmd"; char ap_cs[]="now is the time"; //CString ap_cs; //ap_cs="now is the time"; int proof_i; proof_i=shutfile.Open(filid,CFile::modeC...

How to I create a pdf file from Word or Excel files
How do I convert an Excel sheet to a pdf file in Excel 2003? My previous Excel had a pdf button. But I can't find an option to create a pdf file from Office 2003 products. ..pdf is not created by a Microsoft Product. You need to install a full version of Adobe's Acrobat with distiller and / or Writer. Ken "stolitx" wrote: > How do I convert an Excel sheet to a pdf file in Excel 2003? > > My previous Excel had a pdf button. But I can't find an option to create a > pdf file from Office 2003 products. I have full version of Adobe's Acrobat with...

Add multiple domains to spam deny list and real time sbl
Hi, What file can I open in Exchange 2003 to add a list of domains I want to prevent from sending spam, so that I do not have to add each one individualy. Also, how do you set up Exchange 2003 to check the sbl.spamhaus.org real time listing. They list the sites to block and say you can connect to them for free. Can anyone please help? ...

Add SMTP Address
Is there an easy way to add an additional SMTP address to several mailboxes, but not all of them? Exchange 2003 SP2. Thank you, BM Hi, you may create a global group for all of these users. Then, you can create a new recipient policy with a custom filter to add the SMTP address based on the group membership. Use for example an ldap filter like this: (&(&(&(&(objectCategory=*)(memberOf=CN=SMTP Users,OU=Entreprise,DC=ms,DC=local))))) Thierry Frache "BM" <BM@discussions.microsoft.com> a �crit dans le message de news: 9EABE1F4-202F-42B0-8A15-ABFF7827CC97@mi...

Comparing a value in EXCEL and XML files
want to know how to write a code in VB.NET for the following situation > I have a field( Ex. Capital) in my XML file and that field results in a value(Ex. $5000)....now i have my Excel file with multiple worksheets in it....I want to write a code that can read a single field (Ex. Capital) in XML file and then take it's value (Ex.$5000).....After reading the $5000 it should search through my entire Excel file( In all Worksheets) and see if that Value exists ....If it exists then return as "Pass" if not "Fail".....I also hav 1 more condition but first i would like to...

How can I run an XPath on a very large file?
My program runs out of memory when I do this: string filename = @"large.xml"; XPathDocument doc = new XPathDocument(filename); XPathNavigator nav = doc.CreateNavigator(); XPathNodeIterator iterator = nav.Select("//items/item"); while (iterator.MoveNext()) { .... } I get the same behaviour with other XPathDocument constructors too. Can anyone advise how to do an XPath on an XML stream rather than a document? JerryShea wrote: > My program runs out of memory when I do this: > > string filename = @"large.xml"; > XPathDocument doc = new XPathDoc...

Preference for opening new documents
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Is there a preference to prevent a new Word or Excel blank document opening every time I bring up Word (or Excel) from the dock? <br><br>In Office 2004 I kept Word/Excel open but parked in the dock. When I clicked on them, the menu bar for the application opened across the top of the screen but not a new blank document. 90% of my work is modifying existing files so it is tedious to keep having to close the blank documents. <br><br>I have searched preferences but cannot find a way to p...