Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. msxml::ixmldomdocument save method fails

msxml::ixmldomdocument save method fails

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VC Maniac
    wrote on last edited by
    #1

    I pass the full path of the file to the save function. returns "Unspecified error". What might be the problem?

    K CPalliniC 2 Replies Last reply
    0
    • V VC Maniac

      I pass the full path of the file to the save function. returns "Unspecified error". What might be the problem?

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #2

      Has the path string the right object type? Use the correct string type!!! What is the return code? (Access rights of the writing process to target location?)

      Greetings from Germany

      1 Reply Last reply
      0
      • V VC Maniac

        I pass the full path of the file to the save function. returns "Unspecified error". What might be the problem?

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        What about dopcumentation? You should check the returned HRESULT value. This page [^] contains the following nice C++ example:

        BOOL DOMDocSaveLocation()
        {
        BOOL bResult = FALSE;
        IXMLDOMDocument *pIXMLDOMDocument = NULL;
        HRESULT hr;

        try
        {
        _variant_t varString = _T("D:\\sample.xml");
        // Initialize pIXMLDOMDocument (create a DOMDocument).
        // Load document.
        hr = pIXMLDOMDocument->save(varString);
        if(SUCCEEDED(hr))
        bResult = TRUE;
        }
        catch(...)
        {
        DisplayErrorToUser();
        // Release the IXMLDOMDocument interface.
        }
        // Release the IXMLDOMDocument interface when finished with it.
        return bResult;
        }

        :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        V 1 Reply Last reply
        0
        • CPalliniC CPallini

          What about dopcumentation? You should check the returned HRESULT value. This page [^] contains the following nice C++ example:

          BOOL DOMDocSaveLocation()
          {
          BOOL bResult = FALSE;
          IXMLDOMDocument *pIXMLDOMDocument = NULL;
          HRESULT hr;

          try
          {
          _variant_t varString = _T("D:\\sample.xml");
          // Initialize pIXMLDOMDocument (create a DOMDocument).
          // Load document.
          hr = pIXMLDOMDocument->save(varString);
          if(SUCCEEDED(hr))
          bResult = TRUE;
          }
          catch(...)
          {
          DisplayErrorToUser();
          // Release the IXMLDOMDocument interface.
          }
          // Release the IXMLDOMDocument interface when finished with it.
          return bResult;
          }

          :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          V Offline
          V Offline
          VC Maniac
          wrote on last edited by
          #4

          Its working. now I change the directory permissions just before calling save.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups