在同一位置读取和更新XML文件 [英] Read and Update XML files in same location

查看:97
本文介绍了在同一位置读取和更新XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

是否有人知道如何从某个位置读取XML文件,并且一旦加载该XML文件,需要进行更改,然后必须在同一位置进行更新.如果有人有任何想法,请帮忙.好吧,我已经阅读了一些文章,但是它不适合我的情况.

供您参考,这是我设置源路径并在组合框中获取文件名的方式.
sourcepath = App.Path & "\xmlfiles\" & strVol & ".xml"

期待您的答复,在此先谢谢您.

Dear All,

Does anyone know how to read the XML files from a location and once it has been loaded, need to make changes and then it has to be updated in the same location. If anyone has any idea, kindly help. Well I have read some articles but it does not suits to my scenario.

For your reference this is how I have set my source path and got the filenames in a combobox.
sourcepath = App.Path & "\xmlfiles\" & strVol & ".xml"

Looking forward for your replies, Thanks in advance.

推荐答案

实现这一目标的最佳方法是停止使用VB6,并且永远不要返回它.
如果由于某种奇怪的原因而无法执行此操作,则正确的方法是使用DOM接口.将XML解析为DOM,对DOM进行所有修改,并将DOM作为XML文件存储在同一位置.在此操作过程中,文件将打开和关闭两次.

请参阅此文章以说明如何执行此操作: http://www .techrepublic.com/article/creating-xml-documents-with-the-dom-in-vb6/1044759 [
Best way to achieve that is stop using VB6 and never return to it.

If by some weird reason you cannot do it, the right approach is using DOM interface. Parse XML into DOM, make all modifications on DOM and store DOM as XML file at the same location. The file will be opened and closed twice during this course of operations.

See this article explaining how to do it: http://www.techrepublic.com/article/creating-xml-documents-with-the-dom-in-vb6/1044759[^].

—SA


这篇关于在同一位置读取和更新XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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