pocket pc msxml save() problem 
Author Message
 pocket pc msxml save() problem

Hi ,

I am able to load the xml without using FileStream. When I
use the three pocket pc workaround statements, FileStream
is not needed. the document is loaded and i am able to
access child nodes. now the problem is , i am not able to
save the document. I used two methods (1 and 2) as given
below. Can anyone kindly
go through and correct me or suggest me what else could be
the problem and how can i overcome this.

Thanks & Regards,
Niranjan

/********** START ***********************/
// loading document without using FileStream
MSXML::IXMLDOMDocument* pDocument;
VARIANT_BOOL     fSuccess(VARIANT_FALSE);

CComVariant      vSource( L"file:\\states.xml" );
HRESULT          hr;
IObjectSafety*   pSafety;
DWORD            dwSupported, dwEnabled;

CoCreateInstance(
MSXML::CLSID_DOMDocument,0,CLSCTX_INPROC_SERVER,MSXML::IID_
IXMLDOMDocument,(void**)&pDocument );

// pocket pc work around
pDocument->QueryInterface( IID_IObjectSafety, (void**)
&pSafety );
pSafety->GetInterfaceSafetyOptions(
MSXML::IID_IXMLDOMDocument, &dwSupported, &dwEnabled );
pSafety->SetInterfaceSafetyOptions(
MSXML::IID_IXMLDOMDocument, dwSupported, 0 );
// end of pocket pc work around

// Load the XML into DOM is successfull.
hr = pDocument->load( vSource, &fSuccess );

// Method 1 to save the xml document with different name
// save the document with new name - This method didn't
work and new.xml was not created
// save return -2147024809 value
CComVariant vDest( L"file:\\new.xml" );
hr = pDocument->save(vDest);

// Method 2 to save the xml document with different xml
document object.
// Create a new DOM with and save pDocument to pDocument1
// at the end, the new.xml file is not updated with
contents of states.xml
CComVariant  vDest( L"file:\\new.xml" );
MSXML::IXMLDOMDocument* pDocument1;
CoCreateInstance(
MSXML::CLSID_DOMDocument,0,CLSCTX_INPROC_SERVER,MSXML::IID_
IXMLDOMDocument,(void**)&pDocument1 );

// pocket pc work around
pDocument1->QueryInterface( IID_IObjectSafety, (void**)
&pSafety );
pSafety->GetInterfaceSafetyOptions(
MSXML::IID_IXMLDOMDocument, &dwSupported, &dwEnabled );
pSafety->SetInterfaceSafetyOptions(
MSXML::IID_IXMLDOMDocument, dwSupported, 0 );
// end of pocket pc work around

// This load() returns 1                
hr = pDocument1->load( vDest, &fSuccess );
if ( FAILED(hr) ){
        MessageBox(_T("error"));

Quote:
}

CComVariant  dest(pDocument1);
// the following save() returns 0
hr = pDocument->save(dest);
if ( FAILED(hr) ){
        MessageBox(_T("error"));
Quote:
}

pDocument1->Release();

/**********END************************************/



Sun, 26 Dec 2004 13:45:12 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. pocket pc - msxml

2. Pocket PC / Pocket PC 2002: CDialog::m_bFullScreen

3. New article at Pocket PC Developer Network - Testing programs on Pocket PC

4. Pocket PC / Pocket PC 2002: CDialog::m_bFullScreen

5. what differencies are between Pocket PC SDK an Pocket PC 2002 SDK

6. MSXML DOM save problem

7. need help on getting desktop PC to communicate w/ Pocket PC

8. Difference between PalmSize PC et Pocket PC

9. Serial Communication between Pocket PC and Visual C PC Application

10. make a communcation btw pc and pocket pc

11. GetSaveFileName problem on Pocket PC

12. Winsock problem in pocket PC

 

 
Powered by phpBB® Forum Software