Groups | Blog | Home
all groups > dotnet xml > september 2004 >

dotnet xml : Appending XML to an existing XML file


Novice
9/17/2004 2:47:01 PM
Hey all, I've read a few articles about speed and XML processing - so I just
want to make sure that I'm using the right strategy for what I want to
achieve.

I have an XML file that I'm appending to every time a user submits their
information.

Right now I'm using XMLDocument (Load and Save) in conjuncture with
XmlElement objects.

Is this the right approach or is there a faster approach?

Thanks,
Novice

PS Here is a simplified version of what I'm doing:
XmlDocument xdoc = new XmlDocument();
xdoc.Load("results.xml");
XmlNode node = xdoc.SelectSingleNode("//TopNode");
XmlElement newNode = xdoc.CreateElement("UserInput");
newNode.InnerText = Request.Params("SomeInputID");
node.AppendChild(newNode);
xdoc.Save("results.xml");


Oleg Tkachenko [MVP]
9/19/2004 1:14:17 PM
[quoted text, click to view]

You can get much better perf using XML fragment instead of XML document
here. See http://www.tkachenko.com/blog/archives/000053.html

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