2
* Copyright (C) 2004-2008 Geometer Plus <contact@geometerplus.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20
#ifndef __XHTMLREADER_H__
21
#define __XHTMLREADER_H__
27
#include <ZLXMLReader.h>
32
class XHTMLTagAction {
35
virtual ~XHTMLTagAction();
37
virtual void doAtStart(XHTMLReader &reader, const char **xmlattributes) = 0;
38
virtual void doAtEnd(XHTMLReader &reader) = 0;
41
class XHTMLReader : public ZLXMLReader {
44
static std::map<std::string,XHTMLTagAction*> ourTagActions;
45
static void addAction(const std::string &tag, XHTMLTagAction *action);
46
static void fillTagTable();
49
XHTMLReader(BookReader &modelReader);
50
bool readFile(const std::string &pathPrefix, const std::string &fileName, const std::string &referenceName);
52
void startElementHandler(const char *tag, const char **attributes);
53
void endElementHandler(const char *tag);
54
void characterDataHandler(const char *text, int len);
56
const std::vector<std::string> &externalDTDs() const;
59
BookReader &myModelReader;
60
std::string myPathPrefix;
61
std::string myReferenceName;
64
friend class XHTMLTagAction;
65
friend class XHTMLTagParagraphAction;
66
friend class XHTMLTagRestartParagraphAction;
67
friend class XHTMLTagControlAction;
68
friend class XHTMLTagHyperlinkAction;
69
friend class XHTMLTagItemAction;
70
friend class XHTMLTagImageAction;
71
friend class XHTMLTagParagraphWithControlAction;
72
friend class XHTMLTagPreAction;
75
#endif /* __XHTMLREADER_H__ */