Re: MSXML load xml file method hang
- From: "Alex Feinman [MVP]" <public_news@xxxxxxxxxxxxxxx>
- Date: Sun, 19 Jun 2005 15:09:29 -0700
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; }
.
- References:
- MSXML load xml file method hang
- From: apex
- MSXML load xml file method hang
- Prev by Date: Re: Play .wav File
- Next by Date: Re: copy file from pc to pocket pc
- Previous by thread: MSXML load xml file method hang
- Next by thread: Re: MSXML load xml file method hang
- Index(es):
Relevant Pages
|