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 | |
16 | |
17 | #ifndef SAX_DefaultHandler_INCLUDED |
18 | #define SAX_DefaultHandler_INCLUDED |
19 | |
20 | |
21 | #include "Poco/XML/XML.h" |
22 | #include "Poco/SAX/EntityResolver.h" |
23 | #include "Poco/SAX/DTDHandler.h" |
24 | #include "Poco/SAX/ContentHandler.h" |
25 | #include "Poco/SAX/ErrorHandler.h" |
26 | |
27 | |
28 | namespace Poco { |
29 | namespace XML { |
30 | |
31 | |
32 | class XML_API DefaultHandler: public EntityResolver, public DTDHandler, public ContentHandler, public ErrorHandler |
33 | /// Default base class for SAX2 event handlers. |
34 | /// This class is available as a convenience base class for SAX2 applications: |
35 | /// it provides default implementations for all of the |
36 | /// callbacks in the four core SAX2 handler classes: |
37 | /// * EntityResolver |
38 | /// * DTDHandler |
39 | /// * ContentHandler |
40 | /// * ErrorHandler |
41 | /// Application writers can extend this class when they need to implement only |
42 | /// part of an interface; parser writers can instantiate this |
43 | /// class to provide default handlers when the application has not supplied its own. |
44 | { |
45 | public: |
46 | DefaultHandler(); |
47 | /// Creates the DefaultHandler. |
48 | |
49 | ~DefaultHandler(); |
50 | /// Destroys the DefaultHandler. |
51 | |
52 | // EntityResolver |
53 | InputSource* resolveEntity(const XMLString* publicId, const XMLString& systemId); |
54 | void releaseInputSource(InputSource* pSource); |
55 | |
56 | // DTDHandler |
57 | void notationDecl(const XMLString& name, const XMLString* publicId, const XMLString* systemId); |
58 | void unparsedEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId, const XMLString& notationName); |
59 | |
60 | // ContentHandler |
61 | void setDocumentLocator(const Locator* loc); |
62 | void startDocument(); |
63 | void endDocument(); |
64 | void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes); |
65 | void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname); |
66 | void characters(const XMLChar ch[], int start, int length); |
67 | void ignorableWhitespace(const XMLChar ch[], int start, int length); |
68 | void processingInstruction(const XMLString& target, const XMLString& data); |
69 | void startPrefixMapping(const XMLString& prefix, const XMLString& uri); |
70 | void endPrefixMapping(const XMLString& prefix); |
71 | void skippedEntity(const XMLString& name); |
72 | |
73 | // ErrorHandler |
74 | void warning(const SAXException& exc); |
75 | void error(const SAXException& exc); |
76 | void fatalError(const SAXException& exc); |
77 | }; |
78 | |
79 | |
80 | } } // namespace Poco::XML |
81 | |
82 | |
83 | #endif // SAX_DefaultHandler_INCLUDED |
84 | |