Problem with ISAXXMLReader in VS 2003 C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aslane
    New Member
    • Jan 2008
    • 1

    Problem with ISAXXMLReader in VS 2003 C++

    I have followed the Sax2 JumpStart example (http://msdn2.microsoft .com/en-us/library/ms994335.aspx), to implement a xml Parser in my project. The projects uses DirectX to create a device and use it, and a console to show a log (the console only works in debug).

    The parser works well, but when in close my application, the device closes correctly, but the console remains opened. Commenting the parser solves the problem. In release the application closes completely without problems.

    I was wondering if the ISAXXMLReader i use, could be leaving something in memory, altough it is strange that in realese it works correctly. Is this normal? Should I really worry about this? It is really annoying to not be able to close the application correctly in debug.

    The code that calls the parser is this:

    bool CargadorMapasXM L::parseaMapa(c onst char * nombreMapa, logica::Nivel *nivel, gui::NivelGui *nivelGui, EFlagParseo flag)
    {
    //We initiliaze the com
    CoInitialize(NU LL);
    ISAXXMLReader* pRdr = NULL;

    HRESULT hr = CoCreateInstanc e(
    __uuidof(SAXXML Reader),
    NULL,
    CLSCTX_ALL,
    __uuidof(ISAXXM LReader),
    (void **)&pRdr);

    //If it has not failed
    if(!FAILED(hr))
    {
    try
    {
    //We create the handler and assign it to the reader
    MapaXMLHandler * pMXH = new MapaXMLHandler( );
    hr = pRdr->putContentHand ler(pMXH);

    //Some information the handler needs
    pMXH->setNivel(nivel );
    pMXH->setNivelGui(ni velGui);
    pMXH->setFlag(flag );

    //Convert the name of the mpa to "static wchar_t"
    static wchar_t URL[1000];
    mbstowcs( URL, nombreMapa, 999 );
    //#ifdef _DEBUG
    //wprintf(L"\nPar sing document: %s\n", URL);
    //#endif

    //We parse it
    hr = pRdr->parseURL(URL );

    //Free the reader
    pRdr->Release();

    //Destroy the reader
    delete pMXH;
    }
    catch (int e)
    {
    return false;
    }
    }

    if (FAILED(hr))
    return false;

    CoUninitialize( );
    return true;
    }
Working...