Re: MSXML load xml file method hang



I've seen this happen a lot with malformed xml. Basically, whenever load() failed for any reason, some kind of internal exception will be kicked, leaving my thread running, but in some strange state. I never followed up on it and simply made sure that my xml was well-formed (it was static).

A few pointers:
1) Put an exception handler around call to load()
2) set ValidateOnParse to false: pDoc->put_validateOnParse(FALSE)
3) Use fully qualified file path


--
Alex Feinman
---
Visit http://www.opennetcf.org
"apex" <apex_li@xxxxxxxxxxx> wrote in message news:eIXW6fPdFHA.2180@xxxxxxxxxxxxxxxxxxxxxxx
Dear all:
I want to use Microsoft XMLParser ,the following is some code .
the problem is that when i call m_pXMLDoc->load( ...),my application will hang ,and no information is given .
Can someone give me the reason ? What steps did I forget or mistake ?
OS Version: Windows Mobile 2003 second edition.
Device: Dopod 575 smartphone / PPC,smartphone Emulator


Thanks a lot in advance !

CComPtr<IXMLDOMDocument> m_pXMLDoc;

#include <objsafe.h>
#include <objbase.h>
#include <msxml2.h>
#include <atlbase.h>
bool CXMLConfigure::Load()
{

HRESULT _hr;
bool ret = true;
try
{
 _hr =  CoInitializeEx( NULL, COINIT_MULTITHREADED );
 if (FAILED(_hr))
 {
  //ERROR
  THROWIMEXCEPTION( 80041000 );
  return false;
 }

CComQIPtr<IObjectSafety,&IID_IObjectSafety> iSafety( m_pXMLDoc );
if ( iSafety )
{
DWORD dwSupported, dwEnabled;
iSafety->GetInterfaceSafetyOptions( IID_IXMLDOMDocument, &dwSupported, &dwEnabled );
iSafety->SetInterfaceSafetyOptions( IID_IXMLDOMDocument, dwSupported, 0 );
}


 _hr = m_pXMLDoc.CoCreateInstance( __uuidof( DOMDocument ) );
 m_pXMLDoc->put_async( VARIANT_FALSE );
 if (FAILED(_hr))
 {
  //ERROR
  THROWIMEXCEPTION( 80041000 );
 }

 VARIANT_BOOL bSuccess=false;
 HRESULT hr;
 // Can load it from a url/filename...

hr = m_pXMLDoc->load( CComVariant ( L"simple.xml" ), &bSuccess ); // application hang here ???
if( FAILED( hr ) )
{
THROWIMEXCEPTION( 80041001 );;
return false;
}


}catch(...) {
 Unload();
 ret = false;
}

return ret;
}



.



Relevant Pages

  • Re: n-layer approach
    ... Not enough reason for me to re-think yet. ... All it does is give me a whole load of objects to code ... and seperation of resources for code reuse. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: small script question. need proper syntax
    ... I don't want to check for the browser window for the above reason as I only ... > has a rez that is not listed below? ... > sez below it would at least load one image that I define as a default ...
    (microsoft.public.frontpage.client)
  • Re: Returning multiple resultsets usind datadreader
    ... I never used it, however as I see the documentation than the load is using the reader, however does not give you access to that. ... there must be a reason and I am currious about that? ... > into 2 datatables and bind the datatables to datagridviews. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Q for owners of inverter style gensets
    ... noticed with little or no load the engine speed isn't consistent. ... stepper motor is also pulsing. ... for the same reason. ... On economy throttle it runs smoothly at low ...
    (rec.outdoors.rv-travel)