tags:

views:

472

answers:

2

how do i read / write to a remote xml file with vb.net?

+2  A: 

Check out System.Xml.XmlDocument. Its Load method will allow you read a UNC or a URL.

Writing the remote document may present some security challenges. Some questions may arise like:

  • do you have write permissions to overwrite the document after reading and modifying its contents in-memory?
  • is the document on an internal network?
p.campbell
+2  A: 

If it's really remote. I'd suggest wrapping access in a webservice:

If it's a local xml file, or on a LAN, I'd access it directly.

If you have an xml file on a server that is somewhere on the internet , or somewhere on a WAN:

Write the code that deals with the XML, and allows access to the data in it in a webservice by selecting an appropriate set of functions that can be used remotely.

In your example in the comments, you say you have about 100 arrays with 100 items each, I'd assume each array has an indexing reference.

The back-end could be XML, or even a database. To transfer data you could have the webservice with:

GetArray(index) : get's an array by index, returns XML or even maybe CSV. It could return an error code if the index is not found.

PutArray(index,data) : puts data an array by index, data is XML or even maybe CSV.

DelArray(index) : deletes an array from the back-end storage.

Osama ALASSIRY
what does wrapping access in webservice mean?
I__
sorry about the previous brief answer, I had to go out.
Osama ALASSIRY
thank you! can you show me a simple example of editing an xml file remotely?
I__
It depends on how simple or complicated your XML is, can you post an example similar to what you're using.
Osama ALASSIRY
it's very very simple. i will have maybe 100 different arrays, and each array will have about 100 names associated with it. i want to be able to download this entire "tree".
I__
sorry i meant i will have 100 arrays, each with 100 members
I__
its possible that i might not even need to do this through xml. maybe there is a simpler way?
I__
?????????????????
I__