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 Roger <ro...@126.com> on 2006/06/30 13:14:58 UTC

Re: Re: Re: Re: A question about how to throw out and catchaselfdefinedexceptions

Hi Alberto Massari,
    Sorry for misunderstanding your meanings,My command line for runConfigure
is just as following:
	runConfigure -plinux -cgcc -xg++ -minmem -nsocket -tnative -rpthread
I run it when my first build of xerces,should it be run another time?	
Thanks Alberto.
Best wishes!
Roger

======= 2006-06-30 17:59:47 your wrote:=======

>Hi Roger,
>my question was a different one: the files in the 
>MsgLoaders/MsgFile should be compiled inside 
>Xerces only if you are building Xerces for the 
>AS/400 platform, but as you just told me you are 
>using Linux, I asked what command line switches 
>you specified for the runConfigure script (that 
>you had to invoke once in order to build the various Makefile)
>If it turns out that you are not going to compile 
>for AS/400, the instructions to add a new error message are a lot different...
>
>Alberto
>
>At 17.39 30/06/2006 +0800, Roger wrote:
>>Hi Alberto Massari,
>>
>>     I did it in following steps:
>>1. add a #define in ../../src/xercesc/util/MsgLoaders/MsgFile/XMLMessages.h
>>  #define Reader_ZeroMemory      "XMLBEF4"
>>    and add a Reader_ZeroMemory at the tail of char Exceptions[][8]{}
>>2.Add the following lines before ENDPGM in file CrtXMLMsgs
>>CCSID(*JOB)
>>RMVMSGD    MSGID(XMLBEF4) MSGF(&LIBNAME/&FILENAME)
>>ADDMSGD    MSGID(XMLBEF4) MSGF(&LIBNAME/&FILENAME)
>>MSG('Reader_ZeroMemory') SEV(20) DM
>>PLST(*NONE)  LVL('01/14/00' 61) CCSID(*JOB)
>>
>>Then I use 
>>ThrowXMLwithMemMgr(IOException,XMLExcepts::Reader_ZeroMemory, fMemoryManager)
>>to throw exception and catch exceptions in default errorhandler of parser:
>>         DefaultHandler:: fatalError(const SAXParseException& e)
>>    {
>>       .....
>>     }
>>     I don't know whether I described problems explicitly?
>>Best regards!
>>Roger
>>
>>
>>======= 2006-06-30 16:46:16 your wrote:=======
>>
>> >At 09.28 30/06/2006 +0800, Roger wrote:
>> >>Hi, Dear Alberto
>> >>     Thanks!
>> >>     I forgot to tell you that I work on Redhat Linux Enterprise Server
>> >>v4.1, could you tell me how to make a self-defined exception in steps?
>> >>Thanks!
>> >
>> >If you are using Linux, how did you change the
>> >files in the MsgLoaders/MsgFile folder? What did
>> >you specify on the runConfigure command line?
>> >
>> >Alberto
>> >
>> >>Sincerely yours
>> >>Roger
>> >>
>> >>
>> >>
>> >>======= 2006-06-29 16:06:30 you wrote:=======
>> >>
>> >> >
>> >> >Hi Roger,
>> >> >
>> >> >At 18.07 28/06/2006 +0800, Roger wrote:
>> >> >>Hi,Dear Alberto
>> >> >>       I know you from xerces developer mailing lsit and know you are a
>> >> >>excellent xerces developer. I try to subscribe and post questions to
>> >> >>mailing list but everytime Apache server tell me it has no such mailbox.
>> >> >
>> >> >Have you tried sending an empty mail to
>> >> c-users-subscribe@xerces.apache.org ?
>> >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
>> >>yes,but it returned no such mail address
>> >>
>> >> >
>> >> >>     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
>> >> >>         ThrowXMLwithMemMgr(IOException,
>> >> >> XMLExcepts::Reader_ZeroMemory, fMemoryManager);
>> >> >>     }
>> >> >>     else
>> >> >>         return charsDone;
>> >> >>     }
>> >> >>    XMLExcepts::Reader_ZeroMemory is a exception by myself,to do
>> >> >> this,I do 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  get 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 classification of exception
>> >> >>defined in Xerces and how to extend a self-defined exception, could
>> >> >>you give me
>> >> >>some idea? I really need your help!
>> >> >
>> >> >It looks you are on AS/400... and I never touched one of those...
>> >> >However, it looks to me that you forgot to change CrtXMLMsgs, by adding
>> >> >
>> >> >                           CCSID(*JOB)
>> >> >              RMVMSGD    MSGID(XMLBEF4) MSGF(&LIBNAME/&FILENAME)
>> >> >              ADDMSGD    MSGID(XMLBEF4) MSGF(&LIBNAME/&FILENAME)
>> >> >MSG('The passed memory has been eaten up!') SEV(20) DMPLST(*NONE)
>> >> >LVL('01/14/00' 61) CCSID(*JOB)
>> >> >
>> >> >before the ENDPGM instruction.
>> >> >
>> >> >If this doesn't work, you should try using the mailing list, as some
>> >> >AS/400 experts are available there.
>> >> >
>> >> >Hope this helps,
>> >> >Alberto
>> >> >
>> >> >>   Thanks, hope your reply soon.Thanks again!
>> >> >>Sincerely
>> >> >>Roger
>> >> >
>> >> >
>> >>
>> >>= = = = = = = = = = = = = = = = = = = =
>> >>
>> >>
>> >>        致
>> >>礼!
>> >>
>> >>
>> >>        Roger
>> >>        roger1116@126.com
>> >>          2006-06-30
>>
>>= = = = = = = = = = = = = = = = = = = =
>>
>>Best regards!
>>
>>
>>        Roger
>>        roger1116@126.com
>>          2006-06-30

= = = = = = = = = = = = = = = = = = = =
			
Best regards!
 
				 
        Roger
        roger1116@126.com
          2006-06-30


Re: Re: Re: Re: A question about how to throw out and catch a self defined exceptions

Posted by Alberto Massari <am...@datadirect.com>.
At 19.14 30/06/2006 +0800, Roger wrote:
>Hi Alberto Massari,
>     Sorry for misunderstanding your meanings,My command line for runConfigure
>is just as following:
>         runConfigure -plinux -cgcc -xg++ -minmem -nsocket -tnative -rpthread
>I run it when my first build of xerces,should it be run another time?

No, you don't need to run it again; I just needed 
to have a look at it, so that I now know that you 
are using the "InMem" message loader, so what you should do now is:

- edit the 
src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml to add 
the message (being an error related to parsing, 
the proper location would be under the 
<FatalError> element of the <MsgDomain 
Domain="http://apache.org/xml/messages/XML4CErrors">)

- compile the utility found at tools/NLS/Xlat
- run it using

    Xlat /SrcRoot=C:\Xerces-C\ /OutPath=c:\temp\ /OutFmt=CppSrc /Locale=EN_US

- get the XercesMessages_en_US.hpp file from the 
output directory and place it in the 
src/xercesc/util/MsgLoaders/InMemory folder
- get the XMLExceptMsgs.hpp file from the output 
directory and place it in the src/xercesc/util folder
- recompile

Hope this helps,
Alberto

>Thanks Alberto.
>Best wishes!
>Roger
>
>======= 2006-06-30 17:59:47 your wrote£º=======
>
> >Hi Roger,
> >my question was a different one: the files in the
> >MsgLoaders/MsgFile should be compiled inside
> >Xerces only if you are building Xerces for the
> >AS/400 platform, but as you just told me you are
> >using Linux, I asked what command line switches
> >you specified for the runConfigure script (that
> >you had to invoke once in order to build the various Makefile)
> >If it turns out that you are not going to compile
> >for AS/400, the instructions to add a new 
> error message are a lot different...
> >
> >Alberto
> >
> >At 17.39 30/06/2006 +0800, Roger wrote:
> >>Hi Alberto Massari,
> >>
> >>     I did it in following steps:
> >>1. add a #define in ../../src/xercesc/util/MsgLoaders/MsgFile/XMLMessages.h
> >>  #define Reader_ZeroMemory      "XMLBEF4"
> >>    and add a Reader_ZeroMemory at the tail of char Exceptions[][8]{}
> >>2.Add the following lines before ENDPGM in file CrtXMLMsgs
> >>CCSID(*JOB)
> >>RMVMSGD    MSGID(XMLBEF4) MSGF(&LIBNAME/&FILENAME)
> >>ADDMSGD    MSGID(XMLBEF4) MSGF(&LIBNAME/&FILENAME)
> >>MSG('Reader_ZeroMemory') SEV(20) DM
> >>PLST(*NONE)  LVL('01/14/00' 61) CCSID(*JOB)
> >>
> >>Then I use
> >>ThrowXMLwithMemMgr(IOException,XMLExcepts::Rea 
> der_ZeroMemory, fMemoryManager)
> >>to throw exception and catch exceptions in default errorhandler of parser:
> >>         DefaultHandler:: fatalError(const SAXParseException& e)
> >>    {
> >>       .....
> >>     }
> >>     I don't know whether I described problems explicitly?
> >>Best regards!
> >>Roger
> >>
> >>
> >>======= 2006-06-30 16:46:16 your wrote£º=======
> >>
> >> >At 09.28 30/06/2006 +0800, Roger wrote:
> >> >>Hi, Dear Alberto
> >> >>     Thanks!
> >> >>     I forgot to tell you that I work on Redhat Linux Enterprise Server
> >> >>v4.1, could you tell me how to make a self-defined exception in steps?
> >> >>Thanks!
> >> >
> >> >If you are using Linux, how did you change the
> >> >files in the MsgLoaders/MsgFile folder? What did
> >> >you specify on the runConfigure command line?
> >> >
> >> >Alberto
> >> >
> >> >>Sincerely yours
> >> >>Roger
> >> >>
> >> >>
> >> >>
> >> >>======= 2006-06-29 16:06:30 you wrote£º=======
> >> >>
> >> >> >
> >> >> >Hi Roger,
> >> >> >
> >> >> >At 18.07 28/06/2006 +0800, Roger wrote:
> >> >> >>Hi,Dear Alberto
> >> >> >>       I know you from xerces developer 
> mailing lsit and know you are a
> >> >> >>excellent xerces developer. I try to subscribe and post questions to
> >> >> >>mailing list but everytime Apache 
> server tell me it has no such mailbox.
> >> >> >
> >> >> >Have you tried sending an empty mail to
> >> >> c-users-subscribe@xerces.apache.org ?
> >> >>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
> >> >>yes,but it returned no such mail address
> >> >>
> >> >> >
> >> >> >>     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
> >> >> >>         ThrowXMLwithMemMgr(IOException,
> >> >> >> XMLExcepts::Reader_ZeroMemory, fMemoryManager);
> >> >> >>     }
> >> >> >>     else
> >> >> >>         return charsDone;
> >> >> >>     }
> >> >> >>    XMLExcepts::Reader_ZeroMemory is a exception by myself,to do
> >> >> >> this,I do 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  get 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 classification of exception
> >> >> >>defined in Xerces and how to extend a self-defined exception, could
> >> >> >>you give me
> >> >> >>some idea? I really need your help!
> >> >> >
> >> >> >It looks you are on AS/400... and I never touched one of those...
> >> >> >However, it looks to me that you forgot 
> to change CrtXMLMsgs, by adding
> >> >> >
> >> >> >                           CCSID(*JOB)
> >> >> >              RMVMSGD    MSGID(XMLBEF4) MSGF(&LIBNAME/&FILENAME)
> >> >> >              ADDMSGD    MSGID(XMLBEF4) MSGF(&LIBNAME/&FILENAME)
> >> >> >MSG('The passed memory has been eaten up!') SEV(20) DMPLST(*NONE)
> >> >> >LVL('01/14/00' 61) CCSID(*JOB)
> >> >> >
> >> >> >before the ENDPGM instruction.
> >> >> >
> >> >> >If this doesn't work, you should try using the mailing list, as some
> >> >> >AS/400 experts are available there.
> >> >> >
> >> >> >Hope this helps,
> >> >> >Alberto
> >> >> >
> >> >> >>   Thanks, hope your reply soon.Thanks again!
> >> >> >>Sincerely
> >> >> >>Roger
> >> >> >
> >> >> >
> >> >>
> >> >>= = = = = = = = = = = = = = = = = = = =
> >> >>
> >> >>
> >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
> >> >>Àñ£¡
> >> >>
> >> >>
> >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Roger
> >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡roger1116@126.com
> >> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2006-06-30
> >>
> >>= = = = = = = = = = = = = = = = = = = =
> >>
> >>Best regards!
> >>
> >>
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Roger
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡roger1116@126.com
> >>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2006-06-30
>
>= = = = = = = = = = = = = = = = = = = =
>
>Best regards!
>
>
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Roger
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡roger1116@126.com
>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2006-06-30