You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Endy <be...@gel.usherb.ca> on 2001/11/05 18:02:36 UTC
Question about DOMParser and MemBufInputSource
Hi!!
I'm a newbie with the use of Xerces...
I have a class with severals functions. In this class, there are 2 importants functions, load and unload.
The load function creates a MemBufInputSource with a BSTR. Then, it parses the membufinputsource and finally, it gets the document from DOMParser Object to save it in a global DOM_Document variable to the class. This works correctly. (See code below)
The problem is when I use the unload function or any other functions which use the global DOM_Document variable. The DOM_Document variable is NULL and I have access violation.
When the program leaves the load function, Is the membufinputsource released? And so I lose the information contained in the global DOM_Document Variable.
How I can resolve this problem?
Thanks!!
The load function calls this function :
HRESULT CMyClass::ParseDocument( const void* pXML, size_t Size )
{
COM_TRY
const char* pchBufId = "CAdService";
MemBufInputSource memBufIS( const_cast<XMLByte*>( reinterpret_cast<const XMLByte*>( pXML ) ), Size, pchBufId, false );
DOMParser parser;
parser.parse( memBufIS );
MyDoc = parser.getDocument(); //MyDoc is global
COM_CATCH
}
Later, if I try to use MyDoc, it will be NULL.