Hi

I have experienced following problem with Xerces 1.1.0 (C++ version)

I'm trying to demonstrate it on modified SAXCount example:

in SAXCount.cpp in main( ... ) function:

    try
    {
        const unsigned long startMillis = XMLPlatformUtils::getCurrentMillis();
        parser.parse(xmlFile);

     // here I have added new line
        parser.parse("c:\\temp\\test\\my_test.xml");

        const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis();
        duration = endMillis - startMillis;
    }

... so I want to parse the file whose name comes from the command line and 
immediately some other file.
If the second file doesn't exist the call to parse() causes Xerces to crash.

If I coment out the first call to parse ( i.e. parser.parse(xmlFile);) so the 
request to parse the nonexisitng file
comes first everything is OK and the error handler catches "fatal error" 
exception as expected.

In the first case the crash occurs in ReaderMgr.cpp in the  
getLastExtEntityInfo(.. ) method.
I have put some comments here to show what I see in debugger when the method 
gets called  (when "parsing" the nonexisting file)

void ReaderMgr::getLastExtEntityInfo(LastExtEntityInfo& lastInfo) const
{
    //
    //  If the reader stack never got created, then we can't give this
    //  information.
    //
    if (!fReaderStack && !fCurReader)

//  ---- HERE  fReaderStack !=0 and fCurReader == 0 so the conditions fails ----
    {
        lastInfo.systemId = XMLUni::fgZeroLenString;
        lastInfo.publicId = XMLUni::fgZeroLenString;
        lastInfo.lineNumber = 0;
        lastInfo.colNumber = 0;
        return;
    }

    // We have at least one entity so get the data
    const XMLEntityDecl*    theEntity;

// --- HERE the getLastExtEntity() returns value of fCurReader !!! equal to 0 
(see above) !!!!
// --- which is assigned to the theReader variable

    const XMLReader*        theReader = getLastExtEntity(theEntity);

    // Fill in the info structure with the reader we found

// --- and HERE comes the crash as theReader is NULL pointer

    lastInfo.systemId = theReader->getSystemId();
    lastInfo.publicId = theReader->getPublicId();
    lastInfo.lineNumber = theReader->getLineNumber();
    lastInfo.colNumber = theReader->getColumnNumber();
}


regards

Mira

P.S. I have already asked for that in the past hoping a next version would fix 
it.
When do you plan to implement functionality of the Locator class ?


Reply via email to