-2

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

1
  • Alex, can you post some code or edit your question with more details on how the system works, what the remote data looks like, etc?
    – p.campbell
    Commented Jun 9, 2009 at 16:49

2 Answers 2

2

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?
2

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.

7
  • what does wrapping access in webservice mean? Commented Jun 7, 2009 at 14:50
  • sorry about the previous brief answer, I had to go out. Commented Jun 7, 2009 at 16:13
  • thank you! can you show me a simple example of editing an xml file remotely? Commented Jun 7, 2009 at 17:35
  • It depends on how simple or complicated your XML is, can you post an example similar to what you're using. Commented Jun 7, 2009 at 17:43
  • 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". Commented Jun 7, 2009 at 17:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.