menu: added new Keywords tag to .desktop files
[barry.git] / src / xmlparser.h
blobe6038ef746b4affdba4a188818f323eec385efae
1 ///
2 /// \file xmlparser.h
3 /// A simple XML parser (use callback on start, end and data block
4 ///
6 /*
7 Copyright (C) 2010, Nicolas VIVIEN
8 Copyright (C) 2005-2013, Net Direct Inc. (http://www.netdirect.ca/)
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 See the GNU General Public License in the COPYING file at the
20 root directory of this project for more details.
23 #ifndef __XMLPARSER_H__
24 #define __XMLPARSER_H__
27 #include <iostream>
29 #include "dll.h"
30 #include "a_common.h"
32 namespace Barry {
34 namespace XML {
37 class BXEXPORT XMLParser : public xmlpp::SaxParser
39 public:
40 XMLParser(std::istream& input, const char *charset="UTF-8");
41 virtual ~XMLParser(void);
43 virtual bool Run(void);
44 virtual const unsigned long GetDepth(void) const;
46 protected:
47 std::string charset;
48 std::istream& input;
49 unsigned long depth;
51 // SaxParser overrides:
52 virtual void on_start_document();
53 virtual void on_end_document();
54 virtual void on_start_element(const Glib::ustring& name,
55 const xmlpp::SaxParser::AttributeList& properties);
56 virtual void on_end_element(const Glib::ustring& name);
57 virtual void on_characters(const Glib::ustring& characters);
58 virtual void on_comment(const Glib::ustring& text);
59 virtual void on_warning(const Glib::ustring& text);
60 virtual void on_error(const Glib::ustring& text);
61 virtual void on_fatal_error(const Glib::ustring& text);
65 } // namespace XML
67 } // namespace Barry
69 #endif