You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Matthias Hopfer <Ma...@eureka.de> on 2008/06/02 16:36:29 UTC

MemBufInputSource: Unknown Exception

Hi all,

Currently i'm trying to parse a well formed xml from memory via
MemBufInputSource.

// init above works fine
// code start
int CXmlHandler::parseData ( const unsigned 		a_size,
				     const unsigned char*	a_data )
{
	XMLByte* xmlData = (XMLByte*)a_data;
	MemBufInputSource source ( xmlData,
					   a_size,
					   CUnicodeConv ( _T("dummyID")
).getXMLCh() );
	try 
	{
	  // parsing from memory
	  m_pDOMparser->parse ( source );
      }
      catch ( const XMLException& toCatch ) 
	{
        char* message = XMLString::transcode ( toCatch.getMessage() );
	  TRACE ( _T("CXmlHandler::parseDataRequest(): catched
XMLException: %s\n"), message );
        XMLString::release(&message);
      }
      catch ( const DOMException& toCatch ) 
	{
        char* message = XMLString::transcode ( toCatch.msg );
	  TRACE ( _T("CXmlHandler::parseDataRequest(): catched
DOMException: %s\n"), message );
        XMLString::release(&message);
      }
      catch ( const NetAccessorException& toCatch ) 
	{
        char* message = XMLString::transcode ( toCatch.getMessage() );
	  TRACE ( _T("CXmlHandler::parseDataRequest(): catched
NetAccessorException: %s\n"), message );
        XMLString::release(&message);
      }
      catch (...) 
	{
        TRACE ( _T("CXmlHandler::parseDataRequest(): catched UKNOWN
Exception\n") );
      }
//...
}
// code end

Every time i catch an 'Unknown Exception' and i don't know why. If i'm
parsing the file directly from HDD, it works without any errors. The
file itself is a wellformed xml but pretty 'huge' (39610 bytes).
Assuming that there are no mistakes reading the file into memory (did it
quite often...=), i have absolutely no clue what i'm doing wrong.

Anybody hints?

Matthias

RE: [solved/workaround]RE: MemBufInputSource: Unknown Exception

Posted by Matthias Höpfer <Ma...@eureka.de>.
parseData (...) WAS invoked eithter with:
a_data already containing wellformed xml-data (due to size no buffering to hdd was needed).
buffer filled with xml-data read from file were a_data contained the filename. Xmlhandler just parses from memory.


parseData (...) NOW is invoked with:
a_data containing either xml-data OR filename (a_size == 0: a_data contains filename->parse from hdd, otherwise allocate MemBufInputSource object). Xmlhandler decides from which source to parse.

Matthias

-----Original Message-----
From: Alberto Massari [mailto:amassari@datadirect.com] 
Sent: Tuesday, June 03, 2008 10:49 AM
To: c-users@xerces.apache.org
Subject: Re: [solved/workaround]RE: MemBufInputSource: Unknown Exception

Maybe it's just bad naming, but couldn't be that the a_data you are using in the function is the same a_data where you store the file name? 
Are you invoking parseData(a_size, buffer)?

Alberto

Matthias Höpfer wrote:
> Alberto:
> Thanks for your hint.
>
> Steps were as follows:
> - receive xml fragments time by time
> - save to hdd
> - load xml into buffer
> - forward buffer to xmlhandler
> - parse with xerces
>
> Below is the code i loaded the xml into buffer:
>
> 		// reading from file, then forward buffer to xml handler
> 		std::string strfile ( (char*)a_data );
> 		ifstream file ( strfile.c_str(), ios::in );
> 		char* buffer = new char [a_size];
>
> 		file.read ( buffer, a_size );
>
> 		// fwd buffer to xmlhandler an parse with xerces
>
> Anyway, i left the 'load xml to buffer' completely and forwarded just the filename to xerces. Which seems a cleaner solution to me. Adding ios::binary didn't work either. The problem just occurs on this special kind of buffer/filelenght. There's no problem if the size is smaler.
>
> The new steps are:
> - receive xml fragments time by time
> - save to hdd
> - forward filename to xmlhandler
> - parse with xerces
>
> Thanks for your help, folks. Issue solved due to my needs.
>
> Matthias
>
> -----Original Message-----
> From: Alberto Massari [mailto:amassari@datadirect.com]
> Sent: Tuesday, June 03, 2008 10:06 AM
> To: c-users@xerces.apache.org
> Subject: Re: MemBufInputSource: Unknown Exception
>
> The exception should be an UTFDataFormatException, that complains 
> about an invalid UTF-8 structure; if the XML can be parsed when is on 
> the disk, maybe the code that loads it has a bug (maybe you are 
> opening it as a text stream, and single \n gets turned into \n\r)
>
> Alberto
>
>
> Matthias Höpfer wrote:
>   
>> Dave:
>> You're right, i'm using Visual Studio (6.0 beeing exactly). I catch an '...(KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.'. Stepping through  the calling stack didn't help me (me, but maybe someone else...) any further.
>>
>> KERNEL32! 7c812a5b()
>> MSVCRTD! _CxxThrowException@8 + 57 bytes 
>> xercesc_2_8::XMLUTF8Transcoder::checkTrailingBytes(const unsigned 
>> char 205, const unsigned int 1, const unsigned int 1) line 110 
>> xercesc_2_8::XMLUTF8Transcoder::transcodeFrom(const unsigned char * 
>> const 0x01afcc67, const unsigned int 6807, unsigned short * const 
>> 0x01ad8c24, const unsigned int 16384, unsigned int & 36826000, 
>> unsigned char * const 0x01ae0c28) line 246 
>> xercesc_2_8::XMLReader::xcodeMoreChars(unsigned short * const 
>> 0x01ad8c24, unsigned char * const 0x01ae0c28, const unsigned int
>> 16384) line 1751 + 78 bytes
>> xercesc_2_8::XMLReader::refreshCharBuffer() line 547 + 42 bytes 
>> xercesc_2_8::XMLReader::getNextChar(unsigned short & 59792) line 714 
>> +
>> 8 bytes
>> xercesc_2_8::ReaderMgr::getNextChar() line 95 + 15 bytes 
>> xercesc_2_8::IGXMLScanner::scanAttValue(const xercesc_2_8::XMLAttDef 
>> * const 0x00000000, const unsigned short * const 0x01b0cb88, 
>> xercesc_2_8::XMLBuffer & {...}) line 2319 + 14 bytes 
>> xercesc_2_8::IGXMLScanner::scanStartTag(unsigned char & 1) line 1860 
>> +
>> 32 bytes
>> xercesc_2_8::IGXMLScanner::scanContent() line 899 
>> xercesc_2_8::IGXMLScanner::scanDocument(const 
>> xercesc_2_8::InputSource & {...}) line 214 + 8 bytes 
>> xercesc_2_8::AbstractDOMParser::parse(const xercesc_2_8::InputSource 
>> &
>> {...}) line 519 CXmlHandler::parseDataRequest(const unsigned int 
>> 39610, const unsigned char * 0x01ec2b10) line 66 + 17 bytes
>>
>> I still don't know what's wrong. (Therefore i included the calling 
>> stack. Maybe someone's got a clue...)
>>
>> At the moment i'm thinking about inserting an switch deciding between memory or file input. But i'd definitely prefer the memory input source.
>>
>> Matthias
>>
>> -----Original Message-----
>> From: David Bertoni [mailto:dbertoni@apache.org]
>> Sent: Monday, June 02, 2008 7:45 PM
>> To: c-users@xerces.apache.org
>> Subject: Re: MemBufInputSource: Unknown Exception
>>
>> Matthias Hopfer wrote:
>>   
>>     
>>> Hi all,
>>>
>>> Currently i'm trying to parse a well formed xml from memory via 
>>> MemBufInputSource.
>>>
>>> // init above works fine
>>> // code start
>>>     
>>>       
>> ...
>>
>>   
>>     
>>>       catch (...) 
>>> 	{
>>>         TRACE ( _T("CXmlHandler::parseDataRequest(): catched UKNOWN
>>> Exception\n") );
>>>       }
>>> //...
>>> }
>>> // code end
>>>
>>> Every time i catch an 'Unknown Exception' and i don't know why. If 
>>> i'm parsing the file directly from HDD, it works without any errors.
>>> The file itself is a wellformed xml but pretty 'huge' (39610 bytes).
>>> Assuming that there are no mistakes reading the file into memory 
>>> (did it quite often...=), i have absolutely no clue what i'm doing wrong.
>>>
>>> Anybody hints?
>>>     
>>>       
>> If I had to guess, I would say it's an access violation.  However, instead of having us guess, you might want to run this in the debugger. 
>> It looks like you're using Visual Studio, so the debugger will display the type of exception in the output window.  You can also configure the debugger to break when an exception is thrown, which will help you determine where the exception is thrown.
>>
>> Dave
>>
>>   
>>     
>
>
>   


Re: [solved/workaround]RE: MemBufInputSource: Unknown Exception

Posted by Alberto Massari <am...@datadirect.com>.
Maybe it's just bad naming, but couldn't be that the a_data you are 
using in the function is the same a_data where you store the file name? 
Are you invoking parseData(a_size, buffer)?

Alberto

Matthias Höpfer wrote:
> Alberto:
> Thanks for your hint.
>
> Steps were as follows:
> - receive xml fragments time by time
> - save to hdd
> - load xml into buffer
> - forward buffer to xmlhandler
> - parse with xerces
>
> Below is the code i loaded the xml into buffer:
>
> 		// reading from file, then forward buffer to xml handler
> 		std::string strfile ( (char*)a_data );
> 		ifstream file ( strfile.c_str(), ios::in );
> 		char* buffer = new char [a_size];
>
> 		file.read ( buffer, a_size );
>
> 		// fwd buffer to xmlhandler an parse with xerces
>
> Anyway, i left the 'load xml to buffer' completely and forwarded just the filename to xerces. Which seems a cleaner solution to me. Adding ios::binary didn't work either. The problem just occurs on this special kind of buffer/filelenght. There's no problem if the size is smaler.
>
> The new steps are:
> - receive xml fragments time by time
> - save to hdd
> - forward filename to xmlhandler
> - parse with xerces
>
> Thanks for your help, folks. Issue solved due to my needs.
>
> Matthias
>
> -----Original Message-----
> From: Alberto Massari [mailto:amassari@datadirect.com] 
> Sent: Tuesday, June 03, 2008 10:06 AM
> To: c-users@xerces.apache.org
> Subject: Re: MemBufInputSource: Unknown Exception
>
> The exception should be an UTFDataFormatException, that complains about an invalid UTF-8 structure; if the XML can be parsed when is on the disk, maybe the code that loads it has a bug (maybe you are opening it as a text stream, and single \n gets turned into \n\r)
>
> Alberto
>
>
> Matthias Höpfer wrote:
>   
>> Dave:
>> You're right, i'm using Visual Studio (6.0 beeing exactly). I catch an '...(KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.'. Stepping through  the calling stack didn't help me (me, but maybe someone else...) any further.
>>
>> KERNEL32! 7c812a5b()
>> MSVCRTD! _CxxThrowException@8 + 57 bytes 
>> xercesc_2_8::XMLUTF8Transcoder::checkTrailingBytes(const unsigned char 
>> 205, const unsigned int 1, const unsigned int 1) line 110 
>> xercesc_2_8::XMLUTF8Transcoder::transcodeFrom(const unsigned char * 
>> const 0x01afcc67, const unsigned int 6807, unsigned short * const 
>> 0x01ad8c24, const unsigned int 16384, unsigned int & 36826000, 
>> unsigned char * const 0x01ae0c28) line 246 
>> xercesc_2_8::XMLReader::xcodeMoreChars(unsigned short * const 
>> 0x01ad8c24, unsigned char * const 0x01ae0c28, const unsigned int 
>> 16384) line 1751 + 78 bytes
>> xercesc_2_8::XMLReader::refreshCharBuffer() line 547 + 42 bytes 
>> xercesc_2_8::XMLReader::getNextChar(unsigned short & 59792) line 714 + 
>> 8 bytes
>> xercesc_2_8::ReaderMgr::getNextChar() line 95 + 15 bytes 
>> xercesc_2_8::IGXMLScanner::scanAttValue(const xercesc_2_8::XMLAttDef * 
>> const 0x00000000, const unsigned short * const 0x01b0cb88, 
>> xercesc_2_8::XMLBuffer & {...}) line 2319 + 14 bytes 
>> xercesc_2_8::IGXMLScanner::scanStartTag(unsigned char & 1) line 1860 + 
>> 32 bytes
>> xercesc_2_8::IGXMLScanner::scanContent() line 899 
>> xercesc_2_8::IGXMLScanner::scanDocument(const xercesc_2_8::InputSource 
>> & {...}) line 214 + 8 bytes 
>> xercesc_2_8::AbstractDOMParser::parse(const xercesc_2_8::InputSource & 
>> {...}) line 519 CXmlHandler::parseDataRequest(const unsigned int 
>> 39610, const unsigned char * 0x01ec2b10) line 66 + 17 bytes
>>
>> I still don't know what's wrong. (Therefore i included the calling 
>> stack. Maybe someone's got a clue...)
>>
>> At the moment i'm thinking about inserting an switch deciding between memory or file input. But i'd definitely prefer the memory input source.
>>
>> Matthias
>>
>> -----Original Message-----
>> From: David Bertoni [mailto:dbertoni@apache.org]
>> Sent: Monday, June 02, 2008 7:45 PM
>> To: c-users@xerces.apache.org
>> Subject: Re: MemBufInputSource: Unknown Exception
>>
>> Matthias Hopfer wrote:
>>   
>>     
>>> Hi all,
>>>
>>> Currently i'm trying to parse a well formed xml from memory via 
>>> MemBufInputSource.
>>>
>>> // init above works fine
>>> // code start
>>>     
>>>       
>> ...
>>
>>   
>>     
>>>       catch (...) 
>>> 	{
>>>         TRACE ( _T("CXmlHandler::parseDataRequest(): catched UKNOWN
>>> Exception\n") );
>>>       }
>>> //...
>>> }
>>> // code end
>>>
>>> Every time i catch an 'Unknown Exception' and i don't know why. If 
>>> i'm parsing the file directly from HDD, it works without any errors. 
>>> The file itself is a wellformed xml but pretty 'huge' (39610 bytes).
>>> Assuming that there are no mistakes reading the file into memory (did 
>>> it quite often...=), i have absolutely no clue what i'm doing wrong.
>>>
>>> Anybody hints?
>>>     
>>>       
>> If I had to guess, I would say it's an access violation.  However, instead of having us guess, you might want to run this in the debugger. 
>> It looks like you're using Visual Studio, so the debugger will display the type of exception in the output window.  You can also configure the debugger to break when an exception is thrown, which will help you determine where the exception is thrown.
>>
>> Dave
>>
>>   
>>     
>
>
>   


[solved/workaround]RE: MemBufInputSource: Unknown Exception

Posted by Matthias Höpfer <Ma...@eureka.de>.
Alberto:
Thanks for your hint.

Steps were as follows:
- receive xml fragments time by time
- save to hdd
- load xml into buffer
- forward buffer to xmlhandler
- parse with xerces

Below is the code i loaded the xml into buffer:

		// reading from file, then forward buffer to xml handler
		std::string strfile ( (char*)a_data );
		ifstream file ( strfile.c_str(), ios::in );
		char* buffer = new char [a_size];

		file.read ( buffer, a_size );

		// fwd buffer to xmlhandler an parse with xerces

Anyway, i left the 'load xml to buffer' completely and forwarded just the filename to xerces. Which seems a cleaner solution to me. Adding ios::binary didn't work either. The problem just occurs on this special kind of buffer/filelenght. There's no problem if the size is smaler.

The new steps are:
- receive xml fragments time by time
- save to hdd
- forward filename to xmlhandler
- parse with xerces

Thanks for your help, folks. Issue solved due to my needs.

Matthias

-----Original Message-----
From: Alberto Massari [mailto:amassari@datadirect.com] 
Sent: Tuesday, June 03, 2008 10:06 AM
To: c-users@xerces.apache.org
Subject: Re: MemBufInputSource: Unknown Exception

The exception should be an UTFDataFormatException, that complains about an invalid UTF-8 structure; if the XML can be parsed when is on the disk, maybe the code that loads it has a bug (maybe you are opening it as a text stream, and single \n gets turned into \n\r)

Alberto


Matthias Höpfer wrote:
> Dave:
> You're right, i'm using Visual Studio (6.0 beeing exactly). I catch an '...(KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.'. Stepping through  the calling stack didn't help me (me, but maybe someone else...) any further.
>
> KERNEL32! 7c812a5b()
> MSVCRTD! _CxxThrowException@8 + 57 bytes 
> xercesc_2_8::XMLUTF8Transcoder::checkTrailingBytes(const unsigned char 
> 205, const unsigned int 1, const unsigned int 1) line 110 
> xercesc_2_8::XMLUTF8Transcoder::transcodeFrom(const unsigned char * 
> const 0x01afcc67, const unsigned int 6807, unsigned short * const 
> 0x01ad8c24, const unsigned int 16384, unsigned int & 36826000, 
> unsigned char * const 0x01ae0c28) line 246 
> xercesc_2_8::XMLReader::xcodeMoreChars(unsigned short * const 
> 0x01ad8c24, unsigned char * const 0x01ae0c28, const unsigned int 
> 16384) line 1751 + 78 bytes
> xercesc_2_8::XMLReader::refreshCharBuffer() line 547 + 42 bytes 
> xercesc_2_8::XMLReader::getNextChar(unsigned short & 59792) line 714 + 
> 8 bytes
> xercesc_2_8::ReaderMgr::getNextChar() line 95 + 15 bytes 
> xercesc_2_8::IGXMLScanner::scanAttValue(const xercesc_2_8::XMLAttDef * 
> const 0x00000000, const unsigned short * const 0x01b0cb88, 
> xercesc_2_8::XMLBuffer & {...}) line 2319 + 14 bytes 
> xercesc_2_8::IGXMLScanner::scanStartTag(unsigned char & 1) line 1860 + 
> 32 bytes
> xercesc_2_8::IGXMLScanner::scanContent() line 899 
> xercesc_2_8::IGXMLScanner::scanDocument(const xercesc_2_8::InputSource 
> & {...}) line 214 + 8 bytes 
> xercesc_2_8::AbstractDOMParser::parse(const xercesc_2_8::InputSource & 
> {...}) line 519 CXmlHandler::parseDataRequest(const unsigned int 
> 39610, const unsigned char * 0x01ec2b10) line 66 + 17 bytes
>
> I still don't know what's wrong. (Therefore i included the calling 
> stack. Maybe someone's got a clue...)
>
> At the moment i'm thinking about inserting an switch deciding between memory or file input. But i'd definitely prefer the memory input source.
>
> Matthias
>
> -----Original Message-----
> From: David Bertoni [mailto:dbertoni@apache.org]
> Sent: Monday, June 02, 2008 7:45 PM
> To: c-users@xerces.apache.org
> Subject: Re: MemBufInputSource: Unknown Exception
>
> Matthias Hopfer wrote:
>   
>> Hi all,
>>
>> Currently i'm trying to parse a well formed xml from memory via 
>> MemBufInputSource.
>>
>> // init above works fine
>> // code start
>>     
> ...
>
>   
>>       catch (...) 
>> 	{
>>         TRACE ( _T("CXmlHandler::parseDataRequest(): catched UKNOWN
>> Exception\n") );
>>       }
>> //...
>> }
>> // code end
>>
>> Every time i catch an 'Unknown Exception' and i don't know why. If 
>> i'm parsing the file directly from HDD, it works without any errors. 
>> The file itself is a wellformed xml but pretty 'huge' (39610 bytes).
>> Assuming that there are no mistakes reading the file into memory (did 
>> it quite often...=), i have absolutely no clue what i'm doing wrong.
>>
>> Anybody hints?
>>     
> If I had to guess, I would say it's an access violation.  However, instead of having us guess, you might want to run this in the debugger. 
> It looks like you're using Visual Studio, so the debugger will display the type of exception in the output window.  You can also configure the debugger to break when an exception is thrown, which will help you determine where the exception is thrown.
>
> Dave
>
>   


Re: MemBufInputSource: Unknown Exception

Posted by Alberto Massari <am...@datadirect.com>.
The exception should be an UTFDataFormatException, that complains about 
an invalid UTF-8 structure; if the XML can be parsed when is on the 
disk, maybe the code that loads it has a bug (maybe you are opening it 
as a text stream, and single \n gets turned into \n\r)

Alberto


Matthias Höpfer wrote:
> Dave:
> You're right, i'm using Visual Studio (6.0 beeing exactly). I catch an '...(KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.'. Stepping through  the calling stack didn't help me (me, but maybe someone else...) any further.
>
> KERNEL32! 7c812a5b()
> MSVCRTD! _CxxThrowException@8 + 57 bytes
> xercesc_2_8::XMLUTF8Transcoder::checkTrailingBytes(const unsigned char 205, const unsigned int 1, const unsigned int 1) line 110
> xercesc_2_8::XMLUTF8Transcoder::transcodeFrom(const unsigned char * const 0x01afcc67, const unsigned int 6807, unsigned short * const 0x01ad8c24, const unsigned int 16384, unsigned int & 36826000, unsigned char * const 0x01ae0c28) line 246
> xercesc_2_8::XMLReader::xcodeMoreChars(unsigned short * const 0x01ad8c24, unsigned char * const 0x01ae0c28, const unsigned int 16384) line 1751 + 78 bytes
> xercesc_2_8::XMLReader::refreshCharBuffer() line 547 + 42 bytes
> xercesc_2_8::XMLReader::getNextChar(unsigned short & 59792) line 714 + 8 bytes
> xercesc_2_8::ReaderMgr::getNextChar() line 95 + 15 bytes
> xercesc_2_8::IGXMLScanner::scanAttValue(const xercesc_2_8::XMLAttDef * const 0x00000000, const unsigned short * const 0x01b0cb88, xercesc_2_8::XMLBuffer & {...}) line 2319 + 14 bytes
> xercesc_2_8::IGXMLScanner::scanStartTag(unsigned char & 1) line 1860 + 32 bytes
> xercesc_2_8::IGXMLScanner::scanContent() line 899
> xercesc_2_8::IGXMLScanner::scanDocument(const xercesc_2_8::InputSource & {...}) line 214 + 8 bytes
> xercesc_2_8::AbstractDOMParser::parse(const xercesc_2_8::InputSource & {...}) line 519
> CXmlHandler::parseDataRequest(const unsigned int 39610, const unsigned char * 0x01ec2b10) line 66 + 17 bytes
>
> I still don't know what's wrong. (Therefore i included the calling stack. Maybe someone's got a clue...)
>
> At the moment i'm thinking about inserting an switch deciding between memory or file input. But i'd definitely prefer the memory input source.
>
> Matthias
>
> -----Original Message-----
> From: David Bertoni [mailto:dbertoni@apache.org] 
> Sent: Monday, June 02, 2008 7:45 PM
> To: c-users@xerces.apache.org
> Subject: Re: MemBufInputSource: Unknown Exception
>
> Matthias Hopfer wrote:
>   
>> Hi all,
>>
>> Currently i'm trying to parse a well formed xml from memory via 
>> MemBufInputSource.
>>
>> // init above works fine
>> // code start
>>     
> ...
>
>   
>>       catch (...) 
>> 	{
>>         TRACE ( _T("CXmlHandler::parseDataRequest(): catched UKNOWN
>> Exception\n") );
>>       }
>> //...
>> }
>> // code end
>>
>> Every time i catch an 'Unknown Exception' and i don't know why. If i'm 
>> parsing the file directly from HDD, it works without any errors. The 
>> file itself is a wellformed xml but pretty 'huge' (39610 bytes).
>> Assuming that there are no mistakes reading the file into memory (did 
>> it quite often...=), i have absolutely no clue what i'm doing wrong.
>>
>> Anybody hints?
>>     
> If I had to guess, I would say it's an access violation.  However, instead of having us guess, you might want to run this in the debugger. 
> It looks like you're using Visual Studio, so the debugger will display the type of exception in the output window.  You can also configure the debugger to break when an exception is thrown, which will help you determine where the exception is thrown.
>
> Dave
>
>   


RE: MemBufInputSource: Unknown Exception

Posted by Matthias Höpfer <Ma...@eureka.de>.
Dave:
You're right, i'm using Visual Studio (6.0 beeing exactly). I catch an '...(KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.'. Stepping through  the calling stack didn't help me (me, but maybe someone else...) any further.

KERNEL32! 7c812a5b()
MSVCRTD! _CxxThrowException@8 + 57 bytes
xercesc_2_8::XMLUTF8Transcoder::checkTrailingBytes(const unsigned char 205, const unsigned int 1, const unsigned int 1) line 110
xercesc_2_8::XMLUTF8Transcoder::transcodeFrom(const unsigned char * const 0x01afcc67, const unsigned int 6807, unsigned short * const 0x01ad8c24, const unsigned int 16384, unsigned int & 36826000, unsigned char * const 0x01ae0c28) line 246
xercesc_2_8::XMLReader::xcodeMoreChars(unsigned short * const 0x01ad8c24, unsigned char * const 0x01ae0c28, const unsigned int 16384) line 1751 + 78 bytes
xercesc_2_8::XMLReader::refreshCharBuffer() line 547 + 42 bytes
xercesc_2_8::XMLReader::getNextChar(unsigned short & 59792) line 714 + 8 bytes
xercesc_2_8::ReaderMgr::getNextChar() line 95 + 15 bytes
xercesc_2_8::IGXMLScanner::scanAttValue(const xercesc_2_8::XMLAttDef * const 0x00000000, const unsigned short * const 0x01b0cb88, xercesc_2_8::XMLBuffer & {...}) line 2319 + 14 bytes
xercesc_2_8::IGXMLScanner::scanStartTag(unsigned char & 1) line 1860 + 32 bytes
xercesc_2_8::IGXMLScanner::scanContent() line 899
xercesc_2_8::IGXMLScanner::scanDocument(const xercesc_2_8::InputSource & {...}) line 214 + 8 bytes
xercesc_2_8::AbstractDOMParser::parse(const xercesc_2_8::InputSource & {...}) line 519
CXmlHandler::parseDataRequest(const unsigned int 39610, const unsigned char * 0x01ec2b10) line 66 + 17 bytes

I still don't know what's wrong. (Therefore i included the calling stack. Maybe someone's got a clue...)

At the moment i'm thinking about inserting an switch deciding between memory or file input. But i'd definitely prefer the memory input source.

Matthias

-----Original Message-----
From: David Bertoni [mailto:dbertoni@apache.org] 
Sent: Monday, June 02, 2008 7:45 PM
To: c-users@xerces.apache.org
Subject: Re: MemBufInputSource: Unknown Exception

Matthias Hopfer wrote:
> Hi all,
> 
> Currently i'm trying to parse a well formed xml from memory via 
> MemBufInputSource.
> 
> // init above works fine
> // code start
...

>       catch (...) 
> 	{
>         TRACE ( _T("CXmlHandler::parseDataRequest(): catched UKNOWN
> Exception\n") );
>       }
> //...
> }
> // code end
> 
> Every time i catch an 'Unknown Exception' and i don't know why. If i'm 
> parsing the file directly from HDD, it works without any errors. The 
> file itself is a wellformed xml but pretty 'huge' (39610 bytes).
> Assuming that there are no mistakes reading the file into memory (did 
> it quite often...=), i have absolutely no clue what i'm doing wrong.
> 
> Anybody hints?
If I had to guess, I would say it's an access violation.  However, instead of having us guess, you might want to run this in the debugger. 
It looks like you're using Visual Studio, so the debugger will display the type of exception in the output window.  You can also configure the debugger to break when an exception is thrown, which will help you determine where the exception is thrown.

Dave

Re: MemBufInputSource: Unknown Exception

Posted by David Bertoni <db...@apache.org>.
Matthias Hopfer wrote:
> Hi all,
> 
> Currently i'm trying to parse a well formed xml from memory via
> MemBufInputSource.
> 
> // init above works fine
> // code start
...

>       catch (...) 
> 	{
>         TRACE ( _T("CXmlHandler::parseDataRequest(): catched UKNOWN
> Exception\n") );
>       }
> //...
> }
> // code end
> 
> Every time i catch an 'Unknown Exception' and i don't know why. If i'm
> parsing the file directly from HDD, it works without any errors. The
> file itself is a wellformed xml but pretty 'huge' (39610 bytes).
> Assuming that there are no mistakes reading the file into memory (did it
> quite often...=), i have absolutely no clue what i'm doing wrong.
> 
> Anybody hints?
If I had to guess, I would say it's an access violation.  However, 
instead of having us guess, you might want to run this in the debugger. 
It looks like you're using Visual Studio, so the debugger will display 
the type of exception in the output window.  You can also configure the 
debugger to break when an exception is thrown, which will help you 
determine where the exception is thrown.

Dave