1//
2// WhitespaceFilter.h
3//
4// Library: XML
5// Package: SAX
6// Module: WhitespaceFilter
7//
8// Definition of the WhitespaceFilter 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_WhitespaceFilter_INCLUDED
18#define SAX_WhitespaceFilter_INCLUDED
19
20
21#include "Poco/XML/XML.h"
22#include "Poco/SAX/XMLFilterImpl.h"
23#include "Poco/SAX/LexicalHandler.h"
24
25
26namespace Poco {
27namespace XML {
28
29
30class XML_API WhitespaceFilter: public XMLFilterImpl, public LexicalHandler
31 /// This implementation of the SAX2 XMLFilter interface
32 /// filters all whitespace-only character data element
33 /// content.
34{
35public:
36 WhitespaceFilter();
37 /// Creates the WhitespaceFilter, with no parent.
38
39 WhitespaceFilter(XMLReader* pReader);
40 /// Creates the WhitespaceFilter with the specified parent.
41
42 ~WhitespaceFilter();
43 /// Destroys the WhitespaceFilter.
44
45 // XMLReader
46 void setProperty(const XMLString& propertyId, const XMLString& value);
47 void setProperty(const XMLString& propertyId, void* value);
48 void* getProperty(const XMLString& propertyId) const;
49
50 // ContentHandler
51 void startDocument();
52 void endDocument();
53 void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attrList);
54 void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname);
55 void characters(const XMLChar ch[], int start, int length);
56 void ignorableWhitespace(const XMLChar ch[], int start, int length);
57 void processingInstruction(const XMLString& target, const XMLString& data);
58
59 // LexicalHandler
60 void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId);
61 void endDTD();
62 void startEntity(const XMLString& name);
63 void endEntity(const XMLString& name);
64 void startCDATA();
65 void endCDATA();
66 void comment(const XMLChar ch[], int start, int length);
67
68protected:
69 void setupParse();
70
71private:
72 LexicalHandler* _pLexicalHandler;
73 XMLString _data;
74 bool _filter;
75};
76
77
78} } // namespace Poco::XML
79
80
81#endif // SAX_WhitespaceFilter_INCLUDED
82