473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Saving XML DOMDocument

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
Jul 20 '05 #1
3 17328
On 26 Aug 2003 15:02:33 -0700, sa************@yahoo.co.uk
(Rinchenzo-La) wrote:
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()
{ <snip/>
//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.../xmmthsave.asp

Regards,
Steve
Jul 20 '05 #2
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...

Steve van Dongen <st*****@hotmail.com> wrote in message news:<f8********************************@4ax.com>. ..
On 26 Aug 2003 15:02:33 -0700, sa************@yahoo.co.uk
(Rinchenzo-La) wrote:
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()
{

<snip/>
//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.../xmmthsave.asp

Regards,
Steve

Jul 20 '05 #3
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!

Steve van Dongen <st*****@hotmail.com> wrote in message news:<f8********************************@4ax.com>. ..
On 26 Aug 2003 15:02:33 -0700, sa************@yahoo.co.uk
(Rinchenzo-La) wrote:
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()
{

<snip/>
//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.../xmmthsave.asp

Regards,
Steve

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Börni | last post by:
Hi, The question might sound (and probably is;-) stupid, but why doesnt the follwing code work?? Is there something i dont see? $doc = new DOMDocument('1.0', 'iso-8859-1'); $doc->formatOutput =...
1
by: Mini Mouse | last post by:
Hiya folks, I'm getting the following error(s) below and I'm at a bit of a loss as to how to correct it. When I give it a parameter it then complains it needs two parameters and the second one...
7
by: Philipp Lenssen | last post by:
How do I load and save a UTF-8 document in XML in ASP/VBS? Well, the loading* is not the problem actually -- the file is in UTF-8, and understood correctly -- but once saved, the UTF-8 is...
6
by: Nick Warrington | last post by:
Somebody let me loose with ASP and it was all going well until I hit (what I think is ) a minor problem. I am using IIS as a remote configuration tool to modify an XML config file on the server....
3
by: Dean Slindee | last post by:
Newbie question: Any easy way to convert a DOMDocument to a System.Xml.Document? Dim DOMDocument As DOMDocument40 to this Dim xmlDoc As System.Xml.XmlDocument Thanks,
2
by: Sebastian Araya | last post by:
Hello, I'm trying to create a single function to append new nodes to a DOMDocument object: public function addElement( $element, $name, $value = '', $attrs = Null ) { if( !( $created =...
0
by: paulroskilly | last post by:
Hi, Im using the DomDocument class in PHP5 to parse thru a xml file, but it keeps timing out on the load method : $dom = new DomDocument(); $dom->load("<some url>"); Browsing to the url in...
90
by: charlesmusco | last post by:
Hi all. I have the following problem. I have an xml file, while I will list below and I am trying to add nodes to the xml document based on user input to a form. The XML doc is ... <?xml...
4
by: dcrackel | last post by:
I hope there is a simple solution to this, but I've been unable to find it. $dom = new DomDocument(); $dom->load("test.xml"); $test = $dom->getElementsByTagName("test"); $test->nodeValue =...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.