You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by wi...@jpmorgan.com on 2002/02/11 13:27:49 UTC

Sample Code Error

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: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org