00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef XMLENTITY_H
00020 #define XMLENTITY_H
00021
00022 #include <string>
00023 #include <vector>
00024
00025
00026 class XMLnode
00027 {
00028 protected:
00029 std::string id;
00030 std::string content;
00031 std::vector<XMLnode*> nodelist;
00032 bool no_close;
00033
00034 public:
00035 XMLnode() : no_close(false)
00036 { }
00037 XMLnode(const std::string &i) : id(i), no_close(false)
00038 { }
00039 XMLnode(const XMLnode &n) : id(n.id),content(n.content),nodelist(n.nodelist), no_close(false)
00040 { }
00041 ~XMLnode();
00042
00043 XMLnode &operator=(const XMLnode &n) { id=n.id; content=n.content; nodelist=n.nodelist; no_close = n.no_close; return *this; }
00044 const std::string &reference(const std::string &,bool &);
00045 const XMLnode *subtree(const std::string &) const;
00046
00047 const std::string &value(void) const
00048 { return content; }
00049
00050 typedef std::pair<std::string, std::string> KeyType;
00051 typedef std::vector<KeyType> KeyTypeList;
00052
00053 bool searchpairs(KeyTypeList &ktl, const std::string &basekey, const std::string currkey, const unsigned int pos);
00054 void selectpairs(KeyTypeList &ktl, const std::string currkey);
00055
00056 std::string dump(int depth = 0);
00057 void dump(std::ostream &o, const std::string &indentstr, const unsigned int depth=0) const;
00058
00059 void xmlassign(const std::string &key, const std::string &value);
00060 void xmlparse(const std::string &s,std::size_t &pos);
00061
00062 void listkeys(const std::string &,std::vector<std::string> &, bool longformat=true) const;
00063 };
00064
00065 #endif