如何将编辑的XML保存到我们从中读取数据的同一文件中 [英] How to Save The Edited XML into the same file which we read data from

查看:52
本文介绍了如何将编辑的XML保存到我们从中读取数据的同一文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?xml version="1.0" encoding="UTF-8"?>
<category>
<aaa>
<bbb>
<ccc>
<ddd>
<eee>
<abc>name</abc>
<cde>student</cde>
<fff>
<fgh>phone</fgh>
<hij>address</hij>
</fff>
</eee>





SO我有如上所示的Xml所以我有显示格式如下



Lable Textbox

abc name

cde student



所以我想保存在textbox中所做的更改。我正在阅读和写作是相同的

xml文件,我是read.so我在其点击事件上有保存按钮我已将新更改保存在xml文档中。



文档大小最多为10 MB大文件。 xml标记名称不会被更改,但我们必须更改xml文件中的一小部分,这意味着只有选定的节点子元素我们已经更改了xml内容,其余的xml将保持不变。





所以我试过但我得到的解决方案请提前解决。



SO i Have Xml as shown above so I have Displayed In the following format

Lable Textbox
abc name
cde student

so i want to save the changes made in the textbox.i am reading and writing is the same
xml file which i am reading.so i have save button on its click event i have save the new changes in the xml document.

Document size is up to 10 mb a large file. xml tag name will not be changed but we have to change a small section in xml file that means only for selected node child elements we have change the xml content and rest of the xml will remain the same.


So i tried but i am getting the solution please give a solution thanks In advance.

推荐答案

对于大的文件,使用临时文件名来SAFER写新文件,然后删除旧文件并将临时文件重命名为以前的文件名。



你从来没有说出问题所在,所以这是你要解决问题的最佳答案。
For files that large, it's SAFER to write the new file using a temporary file name, then delete the old file and rename the temp file to the previous file name.

You never said what the problem was, so that's about the best answer you're going to get until you expound on the problem.


这篇关于如何将编辑的XML保存到我们从中读取数据的同一文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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