如何在asp.net的xml文件中插入数据? [英] How to insert data into xml file in asp.net ?

查看:62
本文介绍了如何在asp.net的xml文件中插入数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我有文本框,我想在xml文件中插入用表格填写数据的数据.我该怎么做..有没有代码可以帮助我,因为我尝试使用不同的代码并且不和我一起工作

解决方案

问题是:如果您尝试使用不同的代码"而不是进行编程,即使获得了一些帮助,对您也将毫无用处.您通常没有说明如何使用XML,应该在哪里插入数据,您的目标是什么.这个问题与ASP.NET没有关系,因此您应该删除此标记.

因此,这里有一些想法:1)XML是结构化的,因此您可以在XML节点而不是XML中插入一些数据; 2)您应该使用XML,而不是XML文件;因此,您可以读取和解析整个XML,对其进行修改,然后将整个内容写入文件;如果数据足够小以适合内存,则可以执行此操作; 3)更好的是,您应该使用数据,而不是XML;因此,请了解序列化并使用它.

http://en.wikipedia.org/wiki/Serialization [ http://msdn.microsoft.com/en-us/library/ms233843.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/7ay27kt9%28v = vs.100%29.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/ms733127.aspx [ ^ ].

—SA


hi i have textboxe(s) and i wanna to insert the data that i fill the form with it in xml file..how i can do that..is there any code could help me ,since i try different codes and don''t work with me

解决方案

The problem is: if you "try different codes" instead of doing programming, even if you get some help, it would be useless for you. You did not explain how you work with XML in general, where the data should be inserted, what''s your goal. The question has nothing to do with ASP.NET, so you should remove this tag.

So, here is some ideas: 1) XML is structured, so you can insert some data in XML node, not XML; 2) you should work with XML, not XML file; so, you can read and parse the whole XML, modify it, and write the whole thing to the file; you can do it if the data is small enough to fit in memory; 3) better yet, you should work with data, not with XML; so learn about serialization and use it.

http://en.wikipedia.org/wiki/Serialization[^],
http://msdn.microsoft.com/en-us/library/ms233843.aspx[^],
http://msdn.microsoft.com/en-us/library/7ay27kt9%28v=vs.100%29.aspx[^],
http://msdn.microsoft.com/en-us/library/ms733127.aspx[^].

—SA


这篇关于如何在asp.net的xml文件中插入数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆