2 * libxml++ and this file are copyright (C) 2000 by Ari Johnson, and
3 * are covered by the GNU Lesser General Public License, which should be
4 * included with libxml++ as the file COPYING.
13 #include <libxml/parser.h>
14 #include <libxml/tree.h>
27 typedef list<XMLNode *> XMLNodeList;
28 typedef XMLNodeList::iterator XMLNodeIterator;
29 typedef XMLNodeList::const_iterator XMLNodeConstIterator;
30 typedef list<XMLProperty*> XMLPropertyList;
31 typedef XMLPropertyList::iterator XMLPropertyIterator;
32 typedef XMLPropertyList::const_iterator XMLPropertyConstIterator;
33 typedef map<string, XMLProperty*> XMLPropertyMap;
44 XMLTree(const string &fn);
45 XMLTree(const XMLTree *);
48 bool initialized() const { return _initialized; };
49 XMLNode *root() const { return _root; };
50 XMLNode *set_root(XMLNode *n) { return _root = n; };
52 const string & filename() const { return _filename; };
53 const string & set_filename(const string &fn) { return _filename = fn; };
55 int compression() const { return _compression; };
56 int set_compression(int);
59 bool read(const string &fn) { set_filename(fn); return read(); };
60 bool read_buffer(const string &);
63 bool write(const string &fn) { set_filename(fn); return write(); };
65 void debug (FILE*) const;
67 const string & write_buffer() const;
76 XMLNodeList _children;
77 XMLPropertyList _proplist;
78 XMLPropertyMap _propmap;
81 XMLNode(const string &);
82 XMLNode(const string &, const string &);
83 XMLNode(const XMLNode&);
86 bool initialized() const { return _initialized; };
87 const string name() const { return _name; };
89 bool is_content() const { return _is_content; };
90 const string & content() const { return _content; };
91 const string & set_content(const string &);
92 XMLNode *add_content(const string & = string());
94 const XMLNodeList & children(const string & = string()) const;
95 XMLNode *add_child(const string &);
96 XMLNode *add_child_copy(const XMLNode&);
97 void add_child_nocopy (XMLNode&);
99 const XMLPropertyList & properties() const { return _proplist; };
100 XMLProperty *property(const string &);
101 const XMLProperty *property(const string &n) const
102 { return ((XMLNode *) this)->property(n); };
103 XMLProperty *add_property(const string &, const string & = string());
104 void remove_property(const string &);
106 /** Remove all nodes with the name passed to remove_nodes */
107 void remove_nodes(const string &);
108 /** Remove and delete all nodes with the name passed to remove_nodes */
109 void remove_nodes_and_delete(const string &);
118 XMLProperty(const string &n, const string &v = string());
121 const string & name() const { return _name; };
122 const string & value() const { return _value; };
123 const string & set_value(const string &v) { return _value = v; };