all groups > dotnet xml > march 2004 >
You're in the

dotnet xml

group:

append data to XML file


append data to XML file RCIC
3/29/2004 6:51:10 AM
dotnet xml:
Hi

I want to start with with xml

<?xml version="1.0" encoding="utf-8"?><ControlNumbers><ControlNumber InputType="1" Number="12347" /></ControlNumbers

and append xml to get this result

<ControlNumbers><ControlNumber InputType="1" Number="12347" /><ControlNumber InputType="2" Number="12347" /></ControlNumbers

Re: append data to XML file Oleg Tkachenko [MVP]
3/30/2004 12:35:04 PM
[quoted text, click to view]

The easiest way is to load XML into memory (XmlDocument), insert nodes
and save XML back. Obviously that's not the most effective way.
If you move to using XML fragment insted of XML document, you can append
data directly to the end of file (e.g. adding log entries to XML log).

--
Oleg Tkachenko [XML MVP, XmlInsider]
AddThis Social Bookmark Button