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