I have some 100 xml documents on a sharepoint website and I would like to replace the value of a particular attribute inside each XML document on the server. To do this:
I would like to run a command line tool developed in Javascript which will ask me the url to access the documents from as the parameter. Here is what I have so far.


function UrlXML(url) {

var http = new ActiveXObject("MSXML2.XmlHttp.6.0");



var xmldoc = new ActiveXObject("MSXML2.DOMDocument.6.0");






function xmlDocrepair(xmldoc) {



Code to find an Element and then repalce the value of a particular attribute.



7 Years
Discussion Span
Last Post by Airshow

You may get lucky here on Daniweb but I think you are going to struggle to find someone with the necessary experience to help you follow through with that particular approach.

MS says here:
"Customer feedback has indicated that it is often difficult for developers to build and run MSXML applications. Sometimes developers find they are using a different version of the library than they expected. Sometimes it is difficult simply to get their application to run."

That document purports to offer guidance to sort out the confusion. I just pray I never see the documents/APIs that caused the difficulties in the first place!

Personally, I would adopt one of two approaches depending on the need for human (your) involvement in the process.

1. Automatic (if your attribute replacement is static or can be determined progammatically): Write a server-side script, (in eg php, jsp, asp, cgi), to iterate through the cgi files in turn, reading each into a language variable then string handling to make the "Namespaces" replacement, then writing back to disk (in another directory so as to preserve the original)

2. Manual (if human intervention is necessary): Write an AJAX application, which :

  1. (client-side) User initiates the process by requesting an array of files to be processed (AJAX request type 1).
  2. (server-side) Returns a json-encoded array of objects each comprising a file path together with its "Namespaces" string (plus anything else you need to know to make the decision as to what the new "Namespaces" string should be).
  3. (client-side) iterates through the json-decoded array, displaying each file path, "Namespaces" string etc, inviting manual input of new "Namespaces" string.
  4. (client-side) User hits "Submit" button to:
    1. send HTTP request with parameters (AJAX request type 2).
    2. display the next item in the files array (back to step 3).
  5. (server-side) Re-reads the indicated file, then string handles to make the indicated "Namespaces" replacement, then writes back to disk (in another directory so as to preserve the original).

There may be some toolkit available to take out the hard work in writing all this but I don't know what it might be. If not, I would consider consider editing the 100 files manually. Could be quicker.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.