~ubuntu-branches/ubuntu/maverick/newsbeuter/maverick

« back to all changes in this revision

Viewing changes to include/xmlpullparser.h

  • Committer: Bazaar Package Importer
  • Author(s): Nico Golde
  • Date: 2007-04-21 19:44:35 UTC
  • Revision ID: james.westby@ubuntu.com-20070421194435-21g6134ws2yvarlt
Tags: upstream-0.3
ImportĀ upstreamĀ versionĀ 0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef XMLPULLPARSER_H_
 
2
#define XMLPULLPARSER_H_
 
3
 
 
4
#include <string>
 
5
#include <utility>
 
6
#include <vector>
 
7
 
 
8
namespace newsbeuter
 
9
{
 
10
 
 
11
class xmlpullparser
 
12
{
 
13
public:
 
14
        enum event { START_DOCUMENT, END_DOCUMENT, START_TAG, END_TAG, TEXT };
 
15
        
 
16
        xmlpullparser();
 
17
        virtual ~xmlpullparser();
 
18
        void setInput(std::istream& is);
 
19
        int getAttributeCount() const;
 
20
        std::string getAttributeName(unsigned int index) const;
 
21
        std::string getAttributeValue(unsigned int index) const;
 
22
        std::string getAttributeValue(const std::string& name) const;
 
23
        event getEventType() const;
 
24
        std::string getText() const;
 
25
        bool isWhitespace() const;
 
26
        event next();
 
27
        
 
28
private:
 
29
        typedef std::pair<std::string,std::string> attribute;
 
30
        std::vector<attribute> attributes;
 
31
        std::string text;
 
32
        std::istream * inputstream;
 
33
        event current_event;
 
34
        
 
35
        int skip_whitespace(std::string& ws);
 
36
        void add_attribute(std::string s);
 
37
        std::string read_tag();
 
38
        event determine_tag_type();
 
39
        std::string decode_attribute(const std::string& s);
 
40
        std::string decode_entities(const std::string& s);
 
41
        std::string decode_entity(std::string s);
 
42
        void remove_trailing_whitespace(std::string& s);
 
43
        
 
44
};
 
45
 
 
46
}
 
47
 
 
48
#endif /*XMLPULLPARSER_H_*/