Hi all!

I have a function that is attempting to parse an XML document in the
form of a string, the code for this function is as follows:

// Initialise variables
        vl_MemBufID_str  = "prodInfo";

// Create a new memory buffer input source
        vl_MemBufInput_ptr = boost::shared_ptr<MemBufInputSource> (
                                        new
MemBufInputSource(reinterpret_cast<const 
                                                XMLByte*>
(cp_Document_str.c_str()), 
                                         static_cast<m>
(cp_Document_str.size()),
vl_MemBufID_str.c_str(), 
                                        false));

// Convert the MemBufInputSource to a DomInputSource
        vl_InputWrapper_ptr = boost::shared_ptr<Wrapper4InputSource> (
                                                                new 
        
Wrapper4InputSource(vl_MemBufInput_ptr.get(), 
                                        false));

        try
                {
// Reset the document pool
                Pvm_Parser->resetDocumentPool();

// Parse the XML string
                Pvl_DomDocument =
Pvm_Parser->parse(*vl_InputWrapper_ptr.get());

// Create a new XMLDocument
                vl_XmlDocument_ptr = boost::shared_ptr<Ctxw_XmlDocument>
(
                                                                new
Ctxw_XmlDocument 
        
(Pvl_DomDocument));

I can continuously use this code to parse documents for about 1 1/2 days
or so and then my program will crash.  The actual crash occurs in the
destructor of XMLReader:

XMLReader::~XMLReader()
{
    fMemoryManager->deallocate(fEncodingStr);
    fMemoryManager->deallocate(fPublicId);              // <-- Crash
    fMemoryManager->deallocate(fSystemId);
    delete fStream;
    delete fTranscoder;
}

It appears it is attempting to deallocate a NULL pointer (fPublicId).
If I inspect the rest of the class it all looks ok so dosent really look
like memory corruption?  I also don't understand how the code appears to
work successfully for 1 1/2 days prior to seeing this error ?

The actual stack trace is as follows:

Xercesc_2_5::XMLReader::~XMLReader() Line 425
Xercesc_2_5::XMLReader::`scalar deleting destructor'() + 0xf
Xercesc_2_5::ReaderMgr::reset() Line 970 + 0x1f
Xercesc_2_5::IGXMLScanner::scanDocument(const xerces_2_5::InputSource
&src={...}) Line 339
Xercesc_2_5::AbstractDOMParser::parse(const xerces_2_5::InputSource &
source={...}) Line 471
Xercesc_2_5::DOMBuilderImpl::parse(const xercesc_2_5::DOMInputSource &
source={...}) Line 469
Ctxw_XmlParser::ReadXml(const
std::basic_string<char,std::char_traits<char>,std::allocator<char>>&
cp_Document_str={...}) Line 881 + 0x48
...
...

I am using version 2.5 of Xerces taken from the nightly build on the
27/07/2004.  The parser I am creating is a DOMBuilder and is created in
the class constructor with the following code :


// Create the implementation string
        bool vl_Success_bl = XMLString::transcode("LS", 
                                vl_TempStr_c, 99);

// Get the DOM implementation
        Pvl_DOMImplementation = 
        DOMImplementationRegistry::getDOMImplementation(vl_TempStr_c);

// Create a new Xerces parser
        Pvm_Parser = boost::shared_ptr<DOMBuilder> 
        ((dynamic_cast<DOMImplementationLS*>(Pvl_DOMImplementation))->
        createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0));

// Set the error handler
        SetXmlErrorHandler (vm_ErrorHandler);



If there is any further information I can provide that would be useful
please let me know.

Any pointers to the potential problem would be greatly appreciated, 

Many thanks

Neil


This email message contains confidential information and is intended for the use of 
its intended recipient only.  Access to this email by anyone else is unauthorised.  If 
you are not the intended recipient you are hereby notified that any use, disclosure, 
copying or distribution or any action taken or omitted to be taken in reliance on it 
is strictly prohibited.

If this communication has been sent to you in error, please notify us immediately.

Action Information Management Ltd.
129 Devizes Road, Hilperton, Trowbridge, Wiltshire BA14 7SZ.
Tel: +44 (0) 1225 711200
Fax: +44 (0) 1225 711222
Website www.aimltd.co.uk
email: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to