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;
43 XMLTree(const string &fn);
44 XMLTree(const XMLTree *);
47 XMLNode *root() const { return _root; };
48 XMLNode *set_root(XMLNode *n) { return _root = n; };
50 const string & filename() const { return _filename; };
51 const string & set_filename(const string &fn) { return _filename = fn; };
53 int compression() const { return _compression; };
54 int set_compression(int);
57 bool read(const string &fn) { set_filename(fn); return read(); };
58 bool read_buffer(const string &);
61 bool write(const string &fn) { set_filename(fn); return write(); };
63 void debug (FILE*) const;
65 const string & write_buffer() const;
73 XMLNodeList _children;
74 XMLPropertyList _proplist;
75 XMLPropertyMap _propmap;
78 XMLNode(const string &);
79 XMLNode(const string &, const string &);
80 XMLNode(const XMLNode&);
83 const string name() const { return _name; };
85 bool is_content() const { return _is_content; };
86 const string & content() const { return _content; };
87 const string & set_content (const string &);
88 XMLNode *add_content(const string & = string());
90 const XMLNodeList & children (const string & = string()) const;
91 XMLNode *add_child (const char *);
92 XMLNode *add_child_copy (const XMLNode&);
93 void add_child_nocopy (XMLNode&);
95 const XMLPropertyList & properties() const { return _proplist; };
96 XMLProperty *property(const char * );
97 const XMLProperty *property(const char * n) const
98 { return ((XMLNode *) this)->property(n); };
99 XMLProperty *add_property(const char *, const string &);
100 XMLProperty *add_property(const char *, const char * = "");
102 void remove_property(const string &);
104 /** Remove all nodes with the name passed to remove_nodes */
105 void remove_nodes(const string &);
106 /** Remove and delete all nodes with the name passed to remove_nodes */
107 void remove_nodes_and_delete(const string &);
116 XMLProperty(const string &n, const string &v = string());
119 const string & name() const { return _name; };
120 const string & value() const { return _value; };
121 const string & set_value(const string &v) { return _value = v; };