Saving XML DOMDocument

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rinchenzo-La

    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.DOMDocum ent");
    var objRootNode;
    var objAmendedNode;

    //load the xml file
    docXML.async = false;
    docXML.resolveE xternals = false;
    docXML.load("XM LDataFile.xml") ;

    //set up the root node
    objRootNode = docXML.document Element;

    //do the stuff here
  • Steve van Dongen

    #2
    Re: Saving XML DOMDocument

    On 26 Aug 2003 15:02:33 -0700, sarahloutaylor@ yahoo.co.uk
    (Rinchenzo-La) wrote:
    [color=blue]
    >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()
    >{[/color]
    <snip/>
    [color=blue]
    > //update the xml file
    > docXML.Save("XM LDataFile.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\XMLDataF ile.xml");
    >docXML.SaveXML ("C:\temp\XMLDa taFile.xml");
    >docXML.SaveXML ("XMLDataFile.x ml");
    >
    >any pointers gratefully received![/color]

    save has a lowercase "s" on it.


    Regards,
    Steve

    Comment

    • Rinchenzo-La

      #3
      Re: Saving XML DOMDocument

      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 <stevevd@hotmai l.com> wrote in message news:<f82rkv8c7 r0e5vkafp7k0udm c9c9uj1cgq@4ax. com>...[color=blue]
      > On 26 Aug 2003 15:02:33 -0700, sarahloutaylor@ yahoo.co.uk
      > (Rinchenzo-La) wrote:
      >[color=green]
      > >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()
      > >{[/color]
      > <snip/>
      >[color=green]
      > > //update the xml file
      > > docXML.Save("XM LDataFile.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\XMLDataF ile.xml");
      > >docXML.SaveXML ("C:\temp\XMLDa taFile.xml");
      > >docXML.SaveXML ("XMLDataFile.x ml");
      > >
      > >any pointers gratefully received![/color]
      >
      > save has a lowercase "s" on it.
      > http://msdn.microsoft.com/library/en.../xmmthsave.asp
      >
      > Regards,
      > Steve[/color]

      Comment

      • Rinchenzo-La

        #4
        Re: Saving XML DOMDocument

        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 <stevevd@hotmai l.com> wrote in message news:<f82rkv8c7 r0e5vkafp7k0udm c9c9uj1cgq@4ax. com>...[color=blue]
        > On 26 Aug 2003 15:02:33 -0700, sarahloutaylor@ yahoo.co.uk
        > (Rinchenzo-La) wrote:
        >[color=green]
        > >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()
        > >{[/color]
        > <snip/>
        >[color=green]
        > > //update the xml file
        > > docXML.Save("XM LDataFile.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\XMLDataF ile.xml");
        > >docXML.SaveXML ("C:\temp\XMLDa taFile.xml");
        > >docXML.SaveXML ("XMLDataFile.x ml");
        > >
        > >any pointers gratefully received![/color]
        >
        > save has a lowercase "s" on it.
        > http://msdn.microsoft.com/library/en.../xmmthsave.asp
        >
        > Regards,
        > Steve[/color]

        Comment

        Working...