Saving XML DOMDocument

R

Rinchenzo-La

Hey there

I've got a little stuck with the XML DOM in jscript (only just
learning jscript so this might be a bit of a dumb question!)

I'm using jscript inside an HTML page to open an XML DOMDocument
object, do stuff to the xml then I'd really like to save the changes
(have done this a million times in VB apps) - which is where the
problem comes in....

here's my jscript function that gets called from a button on the hmtl
form:

function SaveCall()
{

//initialise variables
var docXML = new ActiveXObject("MSXML2.DOMDocument");
var objRootNode;
var objAmendedNode;

//load the xml file
docXML.async = false;
docXML.resolveExternals = false;
docXML.load("XMLDataFile.xml");

//set up the root node
objRootNode = docXML.documentElement;

//do the stuff here
 
S

Steve van Dongen

Hey there

I've got a little stuck with the XML DOM in jscript (only just
learning jscript so this might be a bit of a dumb question!)

I'm using jscript inside an HTML page to open an XML DOMDocument
object, do stuff to the xml then I'd really like to save the changes
(have done this a million times in VB apps) - which is where the
problem comes in....

here's my jscript function that gets called from a button on the hmtl
form:

function SaveCall()
{
//update the xml file
docXML.Save("XMLDataFile.xml");
}

when i pressed the save button i get:

Error: Object doesn't support this property or method


i've tried various permutations of the save but none seem to work
e.g

docXML.Save("C:\temp\XMLDataFile.xml");
docXML.SaveXML("C:\temp\XMLDataFile.xml");
docXML.SaveXML("XMLDataFile.xml");

any pointers gratefully received!

save has a lowercase "s" on it.
http://msdn.microsoft.com/library/en-us/xmlsdk30/htm/xmmthsave.asp

Regards,
Steve
 
R

Rinchenzo-La

well spotted!

now i just get the normal 'Permission Denied' error, which is
something to do with browser secuirty settings - still need to figure
out how to get roudn that one...
 
R

Rinchenzo-La

ok sorted it - simply put the update/save function in an external.js
file

no mucking about with browser security settings, .hta apps, registry
settings, xmldso's - happy days!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top