[
Lists Home |
Date Index |
Thread Index
]
- From: Michael Fuller <msf@mds.rmit.edu.au>
- To: Richard Anderson <rja@arpsolutions.demon.co.uk>
- Date: Mon, 6 Dec 1999 20:13:59 +1100
On Fri, Dec 03, 1999 at 08:11:53PM -0000, Richard Anderson wrote:
> How about focusing on SAX/2, and making the first C/C++ SAX interface
> actually SAX 2 so we kill two birds with one stone ?
Good idea!
Here's a [hasty] conversion of the SAX2 Java classes into C++,
along the lines of David and James' posted SAX 1.0/C++ headers
I've used exception specifiers for consistency with the original Java.
// SAX2Decl.h
namespace SAX
{
class Configurable;
class DTDHandler;
class DocumentHandler;
class EntityResolver;
class ErrorHandler;
class InputSource;
class Parser;
class SAXException;
class Configurable
{
public:
virtual void setFeature(SAXString featureId, bool state)
throw(SAXException) = 0;
virtual bool getFeature(SAXString featureId)
throw(SAXException) = 0;
virtual void setProperty(SAXString propertyId, void * value)
throw(SAXException) = 0;
virtual void * getProperty(SAXString propertyId)
throw(SAXException) = 0;
private:
void operator delete (void *);
}
class ConfigurableParserAdapter : public Parser, public Configurable
{
public
ConfigurableParserAdapter(Parser& parser);
// SAX 1.0 methods
void setLocale(const char * locale) throw(SAXException);
void setEntityResolver(EntityResolver& resolver)
void setDTDHandler(DTDHandler& handler)
void setDocumentHandler(DocumentHandler& handler)
void setErrorHandler(ErrorHandler& handler)
void parse(const InputSource& source) throw(SAXException);
void parse(SAXString systemId) throw(SAXException);
// SAX2 methods
void setFeature(SAXString featureId, bool state) throw(SAXException);
bool getFeature(SAXString featureId) throw(SAXException);
void setProperty(SAXString propertyId, void * value)
throw(SAXException);
void * getProperty(SAXString propertyId) throw(SAXException);
private:
void operator delete (void *);
}
class DeclHandler
{
public:
virtual void elementDecl(SAXString name, SAXString model)
throw(SAXException) = 0;
virtual void attributeDecl(SAXString eName,
SAXString aName,
SAXString type,
SAXString valueDefault,
SAXString value)
throw(SAXException) = 0;
virtual void internalEntityDecl(SAXString name, SAXString value)
throw(SAXException) = 0;
virtual void externalEntityDecl(SAXString name,
SAXString publicId,
SAXString systemId)
throw(SAXException) = 0;
private:
void operator delete (void *);
}
class LexicalHandler
{
public:
virtual void startDTD(SAXString name,
SAXString publicId,
SAXString systemId)
throw(SAXException) = 0;
virtual void endDTD() throw(SAXException) = 0;
virtual void startEntity(SAXString name)
throw(SAXException) = 0;
virtual void endEntity(SAXString name)
throw(SAXException) = 0;
virtual void startCDATA() throw(SAXException) = 0;
virtual void endCDATA() throw(SAXException) = 0;
virtual void comment(const SAXChar * ch, int length)
throw(SAXException) = 0;
private:
void operator delete (void *);
}
class NamespaceHandler
{
public:
virtual void startNamespaceDeclScope(SAXString prefix, SAXString uri)
throw(SAXException) = 0;
virtual void endNamespaceDeclScope(SAXString prefix)
throw(SAXException) = 0;
private:
void operator delete (void *);
}
class SAXNotRecognizedException : public SAXException
{
public:
SAXNotRecognizedException(SAXString message);
private:
void operator delete (void *);
}
class SAXNotSupportedException : public SAXException
{
public:
SAXNotSupportedException(SAXString message);
private:
void operator delete (void *);
}
}
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@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@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|