[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

About a C++ interface for event handling

  • From: "Didier PH Martin" <martind@n...>
  • To: "'XML Dev'" <xml-dev@i...>
  • Date: Sun, 12 Dec 1999 17:02:23 -0500

c event handling
Hi,

In order to get a good C++ mapping for XML parsing and also take the
occasion to merge with the SGML world so that it could be possible to have a
parser to do both, here is waht we already have as interface in OpenSP (the
version 1.14 soon to be released)

class document handler
{
  virtual void appinfo(const AppinfoEvent &) = 0;
  virtual void startDtd(const StartDtdEvent &) = 0;
  virtual void endDtd(const EndDtdEvent &) = 0;
  virtual void endProlog(const EndPrologEvent &) = 0;
  virtual void startElement(const StartElementEvent &) =0 ;
  virtual void endElement(const EndElementEvent &) =0 ;
  virtual void data(const DataEvent &) = 0 ;
  virtual void sdata(const SdataEvent &) = 0;
  virtual void pi(const PiEvent &) = 0;
  virtual void externalDataEntityRef(const ExternalDataEntityRefEvent &) =
0;
  virtual void subdocEntityRef(const SubdocEntityRefEvent &) = 0;
  virtual void nonSgmlChar(const NonSgmlCharEvent &) = 0;
  virtual void commentDecl(const CommentDeclEvent &) = 0;
  virtual void markedSectionStart(const MarkedSectionStartEvent &) = 0;
  virtual void markedSectionEnd(const MarkedSectionEndEvent &) = 0;
  virtual void ignoredChars(const IgnoredCharsEvent &) = 0;
  virtual void generalEntity(const GeneralEntityEvent &) = 0;
  virtual void error(const ErrorEvent &) = 0 ;
  virtual void openEntityChange(const OpenEntityPtr &) = 0;
}

Because it is more convenient in C++ to work either with classes or struct,
each member provide an event structure to the interface implementation.
Obvioiusly, for XML some of these members are useless so waht we could have
now is an XML interface having less members and having the SGML interface
having more members and which inherits from the XML interface. This way the
set/superset relationship between SGML and XML would also be expressed with
a class superclass inheritance.

So, for XML what would be useful is:

class IXMLDocumentHandler
{
  virtual void startDtd(const StartDtdEvent &) = 0;
  virtual void endDtd(const EndDtdEvent &) = 0;
  virtual void startElement(const StartElementEvent &) =0 ;
  virtual void endElement(const EndElementEvent &) =0 ;
  virtual void pi(const PiEvent &) = 0;
  virtual void externalDataEntityRef(const ExternalDataEntityRefEvent &) =
0;
  virtual void commentDecl(const CommentDeclEvent &) = 0;
  virtual void error(const ErrorEvent &) = 0 ;
}


Did I forgot anything for XML? So the SGMLDocumentHandler interface would
inherit from the XMLDocumentHandler interface and add waht is necessary for
SGML

class ISGMLDocumentHandler: public IXMLDocumentHandler
{
  virtual void endProlog(const EndPrologEvent &) = 0;
  virtual void data(const DataEvent &) = 0 ;
  virtual void sdata(const SdataEvent &) = 0;
  virtual void subdocEntityRef(const SubdocEntityRefEvent &) = 0;
  virtual void nonSgmlChar(const NonSgmlCharEvent &) = 0;
  virtual void markedSectionStart(const MarkedSectionStartEvent &) = 0;
  virtual void markedSectionEnd(const MarkedSectionEndEvent &) = 0;
  virtual void ignoredChars(const IgnoredCharsEvent &) = 0;
  virtual void generalEntity(const GeneralEntityEvent &) = 0;
  virtual void openEntityChange(const OpenEntityPtr &) = 0;
}

Comments?

Cheers
Didier PH Martin
----------------------------------------------
Email: martind@n...
Conferences:
Web Boston (http://www.mfweb.com)
Markup 99 (http://www.gca.com)
Book:
To come soon: XML Pro published by Wrox Press
Products:
http://www.netfolder.com


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.