DTDHandler.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // DTDHandler.h
  3. //
  4. // Library: XML
  5. // Package: SAX
  6. // Module: SAX
  7. //
  8. // SAX DTDHandler Interface.
  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_DTDHandler_INCLUDED
  16. #define SAX_DTDHandler_INCLUDED
  17. #include "Poco/XML/XML.h"
  18. #include "Poco/XML/XMLString.h"
  19. namespace Poco {
  20. namespace XML {
  21. class XML_API DTDHandler
  22. /// If a SAX application needs information about notations and unparsed entities,
  23. /// then the application implements this interface and registers an instance with the
  24. /// SAX parser using the parser's setDTDHandler method. The parser uses the instance
  25. /// to report notation and unparsed entity declarations to the application.
  26. ///
  27. /// Note that this interface includes only those DTD events that the XML recommendation
  28. /// requires processors to report: notation and unparsed entity declarations.
  29. ///
  30. /// The SAX parser may report these events in any order, regardless of the order in
  31. /// which the notations and unparsed entities were declared; however, all DTD events
  32. /// must be reported after the document handler's startDocument event, and before the first
  33. /// startElement event. (If the LexicalHandler is used, these events must also be reported before the endDTD event.)
  34. ///
  35. /// It is up to the application to store the information for future use (perhaps in a hash table or
  36. /// object tree). If the application encounters attributes of type "NOTATION", "ENTITY", or "ENTITIES",
  37. /// it can use the information that it obtained through this interface to find the entity and/or notation
  38. /// corresponding with the attribute value.
  39. {
  40. public:
  41. virtual void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId) = 0;
  42. /// Receive notification of a notation declaration event.
  43. ///
  44. /// It is up to the application to record the notation for later reference,
  45. /// if necessary; notations may appear as attribute values and in unparsed
  46. /// entity declarations, and are sometime used with processing instruction
  47. /// target names.
  48. ///
  49. /// At least one of publicId and systemId must be non-null. If a system identifier
  50. /// is present, and it is a URL, the SAX parser must resolve it fully before passing
  51. /// it to the application through this event.
  52. ///
  53. /// There is no guarantee that the notation declaration will be reported before any
  54. /// unparsed entities that use it.
  55. ///
  56. /// Note that publicId and systemId maybe null, therefore we pass a pointer rather than a reference.
  57. virtual void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName) = 0;
  58. /// Receive notification of an unparsed entity declaration event.
  59. ///
  60. /// Note that the notation name corresponds to a notation reported by the
  61. /// notationDecl event. It is up to the application to record the entity for
  62. /// later reference, if necessary; unparsed entities may appear as attribute values.
  63. ///
  64. /// If the system identifier is a URL, the parser must resolve it fully before
  65. /// passing it to the application.
  66. ///
  67. /// Note that publicId maybe null, therefore we pass a pointer rather than a reference.
  68. protected:
  69. virtual ~DTDHandler();
  70. };
  71. } } // namespace Poco::XML
  72. #endif // SAX_DTDHandler_INCLUDED