469,364 Members | 2,424 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,364 developers. It's quick & easy.

xml records c# newbee

I need to store records in xml files, i need to load the
record, add new nodes, delete nodes and modify existing ones then
save the file again.

Looks to me like there are different ways of working with xml,
xml file writer and xml documents. Which method is most suitable
to what i want to do? any links to tutorials would be most appreciated,

I have googled around and not really found any examples of what i want to
do.

Thanks in advance

Jun 3 '07 #1
2 2563
tony leake wrote:
I need to store records in xml files, i need to load the
record, add new nodes, delete nodes and modify existing ones then
save the file again.

Looks to me like there are different ways of working with xml,
xml file writer and xml documents. Which method is most suitable
to what i want to do?
Use System.Xml.XmlDocument to load the XML into a DOM tree structure,
then you can manipulate the tree structure (CreateElement,
AppendChild/InsertBefore/InsertAfter to insert elements, RemoveChild to
delete, InnerText to modify) and save the changes back using the Save
method.

Another way the .NET framework offers is XML deserialization and
serialization, that way you define .NET classes with public properties
that map to XML elements or attributes and you do not work with an XML
tree structure but rather with .NET objects and .NET types.

See <http://msdn2.microsoft.com/en-us/library/2bcctyt8(VS.80).aspxfor
an overview and introduction, if you need concrete help after reading
that then post examples of the XML you want to manipulate and we can
show you some code snippet.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 4 '07 #2
Martin Honnen wrote:

Another way the .NET framework offers is XML deserialization and
serialization, that way you define .NET classes with public properties
that map to XML elements or attributes and you do not work with an XML
tree structure but rather with .NET objects and .NET types.
Perfect for what i need, and i found some articles to get me started,
now i know what i'm looking for.

Thanks.
Jun 4 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Newbee | last post: by
2 posts views Thread by Newbee Adam | last post: by
2 posts views Thread by Martin Hvidberg | last post: by
2 posts views Thread by Mel | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.