CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Location
    India,bangalore
    Posts
    295

    XML Save problem in MSXML2::IXMLDOMDocument

    hi,

    I am using MSXML2::IXMLDOMDocumten* pointer to do XMl operations like load/save/add/delete in VC6. It was working fine in VC6.
    Our company upgraded its vc editor from VC6 to VS2005. After converting the project all XML functionality is working fine except save.
    Basically we keep adding elements to xml object and every 5min we keep saving it.

    the Save function code.
    Code:
    bool CGLXMLParser::Save(LPCSTR lpcstrXMLFileName)
    {
        assert (lpcstrXMLFileName != NULL);
    
      CComVariant varFileName = lpcstrXMLFileName;
    
      bool bReturnVal = false;
    
      try
      {
        HRESULT hr = m_pXMLDomDoc->save( varFileName );
    
        if ( SUCCEEDED(hr) )
        {
          m_strXmlFile = lpcstrXMLFileName;
    
          bReturnVal = true;
        }
      }
      catch(...)
      {
      }
    
        return bReturnVal;
    }
    We even tried to Clone the object and save using this function but not working.
    Code:
    MSXML2::IXMLDOMDocumentPtr CGLXMLParser::Clone()
    {
    	if (!m_pXMLDomDoc)
    		return NULL;
    
    	MSXML2::IXMLDOMDocumentPtr xmldoc;
    	xmldoc.CreateInstance(__uuidof(MSXML2::IXMLDOMDocument));
    	_variant_t v(xmldoc.GetInterfacePtr());
    	m_pXMLDomDoc->save(v);
    
      return xmldoc.Detach();
    }
    Later we thought the XML object is accessed by multiple object for adding elements and saving XML. So used critical section for main xml pointer m_pXMLDomDoc before accessing it so that there will not be any lock. still no chance of rectifying it.

    I have attached the whole CGLXMLParser class aswell.
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2002
    Location
    India,bangalore
    Posts
    295

    Re: XML Save problem in MSXML2::IXMLDOMDocument

    If we stop adding to the parser and later save it saves but concurrent operation is not possible.
    Any solution?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured