I believe this was discussed quite a while back, and the conclusion was
that the following is correct and the simplest:
DefaultHandler* defaultHandler= new DefaultHandler();
parser->setContentHandler(defaultHandler);
parser->setErrorHandler(defaultHandler);
No casts are necessary, and creating superfluous variables is just inviting
trouble (and is inefficient).
At any rate, the example is definitely incorrect.
Dave
william.rathbone@j
pmorgan.com To: [EMAIL PROTECTED]
cc:
02/11/2002 04:27 Subject: Sample Code Error
AM
Please respond to
xerces-c-dev
Hi,
I believe the code sample at the following location
http://xml.apache.org/xerces-c/program.html
Under the heading ->
SAX2 Programming Guide
Constructing an XML Reader
Is incorrect.
The section that reads ->
ContentHandler* contentHandler = new DefaultHandler();
ErrorHandler* errHandler = (ErrorHandler*)
contentHandler;
parser->setContentHandler(contentHandler);
parser->setErrorHandler(errHandler);
I believe should read ->
DefaultHandler* defaultHandler= new DefaultHandler();
ContentHandler* contentHandler= (ContentHandler*)
defaultHandler;
ErrorHandler* errHandler = (ErrorHandler*)
defaultHandler;
parser->setContentHandler(contentHandler);
parser->setErrorHandler(errHandler);
If not the virtual function pointer table contained within errHandler is
incorrect (i.e. is some subset of the contentHandler's virtual methods)
......
Thanks
Will
This communication is for informational purposes only. It is not intended
as
an offer or solicitation for the purchase or sale of any financial
instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made
herein
do not necessarily reflect those of J.P. Morgan Chase & Co., its
subsidiaries and affiliates.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]