|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
||||
|
||||
|
Saving files with MSXML DOM
Hi all,
I've looked around here and some Google searches, and I haven't found an answer yet. I know you can load an XML file into memory and make changes to the information from that file. Is it then possible to save those changes back to the file? I found one mention of save() but that seemed to be in reference to ASP. I'm doing this all on the client-side (specifically, with an HTML Application.) The environment is Windows 2000. Thanks. -michael
__________________
In the beginning, the universe was created. This made a lot of people very angry, and has been widely regarded as a bad idea. -- Douglas Adams, The Hitchhiker's Guide to the Universe. |
|
#2
|
|||
|
|||
|
The save() method will work in a HTA file but trying it in a HTML just brings up a "Permission denied" error.
Code:
<script type="text/javascript">
var oXMLDoc=new ActiveXObject("Microsoft.XMLDOM");
oXMLDoc.async=false;
oXMLDoc.loadXML("<TEST/>");
oXMLDoc.save("output.xml");
</script>
Remember that the HTA will save the XML on the client machine, not on the web server. If you want it saved on the server then you'll need to use ASP: Code:
Dim oXMLDoc
Set oXMLDoc=Server.CreateObject("Microsoft.XMLDom")
oXMLDoc.async=False
oXMLDoc.loadXML("<TEST/>")
oXMLDoc.save (Server.Mappath(".") & "\output.xml")
If the server has a newer version of MSXML installed then you're better off using Server.CreateObject("MSXML2.DomDocument"), Microsoft.XMLDOM doesn't support funky stuff like MSXML2.FreethreadedDomDocument, XSL variables and XSL parameters Last edited by teedee : November 7th, 2003 at 06:38 PM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Saving files with MSXML DOM |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|