2
* FBReader -- electronic book reader
3
* Copyright (C) 2004-2007 Nikolay Pultsin <geometer@mawhrin.net>
4
* Copyright (C) 2005 Mikhail Sobolev <mss@mawhrin.net>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
#ifndef __XHTMLREADER_H__
23
#define __XHTMLREADER_H__
29
#include <ZLXMLReader.h>
34
class XHTMLTagAction {
37
virtual ~XHTMLTagAction();
39
virtual void doAtStart(XHTMLReader &reader, const char **xmlattributes) = 0;
40
virtual void doAtEnd(XHTMLReader &reader) = 0;
43
class XHTMLReader : public ZLXMLReader {
46
static std::map<std::string,XHTMLTagAction*> ourTagActions;
47
static void addAction(const std::string &tag, XHTMLTagAction *action);
48
static void fillTagTable();
51
XHTMLReader(BookReader &modelReader);
52
bool readFile(const std::string &pathPrefix, const std::string &fileName, const std::string &referenceName);
54
void startElementHandler(const char *tag, const char **attributes);
55
void endElementHandler(const char *tag);
56
void characterDataHandler(const char *text, int len);
58
const std::vector<std::string> &externalDTDs() const;
61
BookReader &myModelReader;
62
std::string myPathPrefix;
63
std::string myReferenceName;
66
friend class XHTMLTagAction;
67
friend class XHTMLTagParagraphAction;
68
friend class XHTMLTagRestartParagraphAction;
69
friend class XHTMLTagControlAction;
70
friend class XHTMLTagHyperlinkAction;
71
friend class XHTMLTagItemAction;
72
friend class XHTMLTagImageAction;
73
friend class XHTMLTagParagraphWithControlAction;
74
friend class XHTMLTagPreAction;
77
#endif /* __XHTMLREADER_H__ */