DefaultHandler.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // DefaultHandler.h
  3. //
  4. // Library: XML
  5. // Package: SAX
  6. // Module: SAX
  7. //
  8. // SAX-2 DefaultHandler class.
  9. //
  10. // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
  11. // and Contributors.
  12. //
  13. // SPDX-License-Identifier: BSL-1.0
  14. //
  15. #ifndef SAX_DefaultHandler_INCLUDED
  16. #define SAX_DefaultHandler_INCLUDED
  17. #include "Poco/XML/XML.h"
  18. #include "Poco/SAX/EntityResolver.h"
  19. #include "Poco/SAX/DTDHandler.h"
  20. #include "Poco/SAX/ContentHandler.h"
  21. #include "Poco/SAX/ErrorHandler.h"
  22. namespace Poco {
  23. namespace XML {
  24. class XML_API DefaultHandler: public EntityResolver, public DTDHandler, public ContentHandler, public ErrorHandler
  25. /// Default base class for SAX2 event handlers.
  26. /// This class is available as a convenience base class for SAX2 applications:
  27. /// it provides default implementations for all of the
  28. /// callbacks in the four core SAX2 handler classes:
  29. /// * EntityResolver
  30. /// * DTDHandler
  31. /// * ContentHandler
  32. /// * ErrorHandler
  33. /// Application writers can extend this class when they need to implement only
  34. /// part of an interface; parser writers can instantiate this
  35. /// class to provide default handlers when the application has not supplied its own.
  36. {
  37. public:
  38. DefaultHandler();
  39. /// Creates the DefaultHandler.
  40. ~DefaultHandler();
  41. /// Destroys the DefaultHandler.
  42. // EntityResolver
  43. InputSource* resolveEntity(const XMLString* publicId, const XMLString& systemId);
  44. void releaseInputSource(InputSource* pSource);
  45. // DTDHandler
  46. void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId);
  47. void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName);
  48. // ContentHandler
  49. void setDocumentLocator(const Locator* loc);
  50. void startDocument();
  51. void endDocument();
  52. void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes);
  53. void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname);
  54. void characters(const XMLChar ch[], int start, int length);
  55. void ignorableWhitespace(const XMLChar ch[], int start, int length);
  56. void processingInstruction(const XMLString& target, const XMLString& data);
  57. void startPrefixMapping(const XMLString& prefix, const XMLString& uri);
  58. void endPrefixMapping(const XMLString& prefix);
  59. void skippedEntity(const XMLString& name);
  60. // ErrorHandler
  61. void warning(const SAXException& exc);
  62. void error(const SAXException& exc);
  63. void fatalError(const SAXException& exc);
  64. };
  65. } } // namespace Poco::XML
  66. #endif // SAX_DefaultHandler_INCLUDED