Concatenating two XML files using JavaScipt/AJAX

xtron

New Member
I have been tasked with splitting an XML file into two parts for ease of editing.But all the existing codebase is designed to treat it as a single file. As a middle ground (due to a paucity of time) I decided to split the files, but simply concatenate the split files by using the following code\[code\] var xmlDoc; xmlhttp.open("GET","distributome-relations.xml",false); xmlhttp.send(); xmlDoc = xmlhttp.responseXML; xmlhttp=createAjaxRequest(); xmlhttp.open("GET","distributome-references.xml",false); xmlhttp.send(); xmlDoc = xmlDoc+xmlhttp.responseXML; try{ DistributomeXML_Objects=xmlDoc.documentElement.childNodes; }catch(error){ DistributomeXML_Objects=xmlDoc.childNodes; }\[/code\]Which doesn't seem to work while the original code \[code\]xmlhttp.open("GET","Distributome.xml",false); xmlhttp.send(); if (!xmlhttp.responseXML.documentElement && xmlhttp.responseStream) xmlhttp.responseXML.load(xmlhttp.responseStream); xmlDoc = xmlhttp.responseXML; try{ DistributomeXML_Objects=xmlDoc.documentElement.childNodes; }catch(error){ DistributomeXML_Objects=xmlDoc.childNodes; }\[/code\]Works perfectly fine.I'm not sure how to proceed with this. I have simply split the file http://www.distributome.avinashc.com/avinash/Distributome.xml into http://www.distributome.avinashc.com/avinash/distributome-relations.xml and http://www.distributome.avinashc.com/avinash/distributome-references.xml The last two files will appear improperly formatted because only a simple concatenation of the two files is expected to be a valid XML document.I suspect that this is due to the use of the responseXML method and that I should use an alternate method.Is there a better way to do this. I would welcome any suggestions, and of course - answers to my original question.Thanks
 
Back
Top