Hi,everyone
My question is about how to throw out and catch a self-defined
exceptions
in my application. I want to throw an exception when xerces perform
readBytes() result check in xerces/internal/XMLReader.cpp as following:
unsigned int
XMLReader::xcodeMoreChars( XMLCh* const bufToFill
, unsigned char* const charSizes
, const unsigned int maxChars)
//if (!fRawBytesAvail)
// return 0;/*Remarked by Roger*/
.....
// Update the raw buffer index
fRawBufIndex += bytesEaten;
if (charsDone == 0)
{
//Throw out an exception by my self
ThrowXMLwithMemMgr(IOException,XMLExcepts::Reader_ZeroMemory,
fMemoryManager);
}
else
return charsDone;
}
XMLExcepts::Reader_ZeroMemory is a exception by myself,to do
this,I did as following:
1. add a line at the tail of NLS/EN_US/XMLErrList_EN_US.Xml
<Message Id="Reader_ZeroMemory" Text="The passed memory has
been eaten up!"/>
2. add a define line in util/MsgLoaders/MsgFile/XMLMessages.h
#define Reader_ZeroMemory "XMLBEF4"
3. add a line at the tail of util/MsgLoaders/MsgFile/XMLMessages.h
char Exceptions[][8]= {
...
Reader_ZeroMemory
}
I compiled the project and catch an IOException named Message:Attribute
'{0}' has already been declared for element '{1}',I find that this is
not my exception, I don't quite clear with the mechanism of exception
defined in Xerces and how to extend a self-defined exception, could anyone
give me some idea?
Sincerely yours
Roger
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]