SAX/C++: First interface draft

Michael Fuller msf at mds.rmit.edu.au
Mon Dec 6 07:29:26 GMT 1999


On Fri, Dec 03, 1999 at 11:48:47AM +0700, James Clark wrote:
> Here's another draft, with this change and a few other minor changes;
[...]
> - solve the UTF-8/UTF-16 problem by having two namespaces:

As I've suggested elsewhere, this can also be (partially) addressed
by providing both a CharacterStream and a ByteStream. That would change
the InputSource definition to:

 class InputSource
 {
 public:
   virtual SAXString getPublicId () const = 0;
   virtual void setPublicId (SAXString publicId) = 0;

   virtual SAXString getSystemId () const = 0;
   virtual void setSystemId (SAXString systemId) = 0;

   virtual SAXString getEncoding () const = 0;
   virtual void setEncoding(SAXString encoding) = 0;
   
   virtual std::istream * getByteStream () const = 0;
   virtual void setByteStream (std::istream * in) = 0;

   // Issue: is wistream the best C++ cchoice for a Unicode "character" stream,
   // given that sizeof(wchar_t) need not be 2 (eg, under // Sun/Solaris CC)?
   virtual std::wistream * getCharacterStream () const = 0;
   virtual void setCharacterStream (std::wistream * in) = 0;

 private:
   void operator delete (void *);
 };


> Discussion points:
>
> - Would it be better to typedef SAXString to the Standard C++ string
> class (ie std::basic_string<SAXChar>)?

Also:
    The Java definition explicitly indicates what exceptions may be thrown
through out the interface. Should C++ exception specificiers be used to
mirror those semantics?  If that's the case, we probably also need to add
embedded exceptions back into the SAXException class, a la:

	virtual std::exception& getException() const = 0;
	virtual SAXString toString() const = 0;

General query: should there be heavier use of const and "&" amongst
the various function's parameter declarations and return values?

Michael
____________________________________________
http://www.mds.rmit.edu.au/~msf/
Multimedia Databases Group, RMIT, Australia.

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





More information about the Xml-dev mailing list