1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
//
// C++ Interface: saxhandler
//
// Description: Qt SAX2-Handler
//
//
// Author: Robert Vogl <voglrobe@web.de>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef SAXHANDLER_H
#define SAXHANDLER_H
// STL includes
#include <map>
using namespace std;
// Qt includes
#include <qxml.h>
#include <qstring.h>
typedef map<QString, QString> TagMapT;
/**
@author Robert Vogl
*/
class SaxHandler : public QXmlDefaultHandler
{
public:
SaxHandler();
~SaxHandler();
// Reimplementations from base class
bool startElement(const QString &namespaceURI,
const QString &localName,
const QString &qName,
const QXmlAttributes &atts );
bool endElement(const QString &namespaceURI,
const QString &localName,
const QString &qName);
bool characters(const QString &ch);
bool fatalError(const QXmlParseException &exc);
bool resolveEntity(const QString &publicId,
const QString &systemId,
QXmlInputSource* &ret);
bool externalEntityDecl(const QString &name,
const QString &publicId,
const QString &systemId);
bool internalEntityDecl(const QString &name,
const QString &value);
bool skippedEntity(const QString &name);
/**
* Returns the parser result.
*/
void getData( QString &data ) const;
/**
* Reset
*/
void reset();
/**
* Set Mode:
* \param rtf 'true' = Replace DocBook tags with RTF-tags.\n
* 'false' = Ignore tags, return text content only.
*/
void setRTF(bool rtf);
private:
QString m_output;
bool m_rtf;
TagMapT m_tagmap;
};
#endif
|