Saving XML DOMDocument

Discussion in 'Javascript' started by Rinchenzo-La, Aug 26, 2003.

  1. Rinchenzo-La

    Rinchenzo-La Guest

    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
     
    Rinchenzo-La, Aug 26, 2003
    #1
    1. Advertising

  2. On 26 Aug 2003 15:02:33 -0700,
    (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-us/xmlsdk30/htm/xmmthsave.asp

    Regards,
    Steve
     
    Steve van Dongen, Aug 28, 2003
    #2
    1. Advertising

  3. Rinchenzo-La

    Rinchenzo-La Guest

    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 <> wrote in message news:<>...
    > On 26 Aug 2003 15:02:33 -0700,
    > (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-us/xmlsdk30/htm/xmmthsave.asp
    >
    > Regards,
    > Steve
     
    Rinchenzo-La, Aug 30, 2003
    #3
  4. Rinchenzo-La

    Rinchenzo-La Guest

    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 <> wrote in message news:<>...
    > On 26 Aug 2003 15:02:33 -0700,
    > (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-us/xmlsdk30/htm/xmmthsave.asp
    >
    > Regards,
    > Steve
     
    Rinchenzo-La, Aug 30, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jty202

    DomDocument

    jty202, Jan 16, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    532
    Peter Bromberg [C# MVP]
    Jan 17, 2005
  2. bird
    Replies:
    1
    Views:
    4,541
    William Park
    Mar 4, 2005
  3. Replies:
    4
    Views:
    453
    Joe Kesselman
    Nov 3, 2006
  4. MM

    DOMDocument

    MM, Apr 8, 2008, in forum: XML
    Replies:
    1
    Views:
    498
    The Magpie
    Apr 8, 2008
  5. K. Wilder
    Replies:
    1
    Views:
    560
    Dan Brussee
    Sep 16, 2003
Loading...

Share This Page