- XMLNode(const string &);
- XMLNode(const string &, const string &);
- XMLNode(const XMLNode&);
- ~XMLNode();
-
- const string name() const { return _name; };
-
- bool is_content() const { return _is_content; };
- const string & content() const { return _content; };
- const string & set_content (const string &);
- XMLNode *add_content(const string & = string());
-
- const XMLNodeList & children (const string& str = string()) const;
- XMLNode *add_child (const char *);
- XMLNode *add_child_copy (const XMLNode&);
- XMLNode *child (const char*) const;
- void add_child_nocopy (XMLNode&);
-
- const XMLPropertyList & properties() const { return _proplist; };
- XMLProperty *property(const char * );
- const XMLProperty *property(const char * n) const
- { return ((XMLNode *) this)->property(n); };
- XMLProperty *add_property(const char *, const string &);
- XMLProperty *add_property(const char *, const char * = "");
-
- void remove_property(const string &);
-
- /** Remove all nodes with the name passed to remove_nodes */
- void remove_nodes(const string &);
- /** Remove and delete all nodes with the name passed to remove_nodes */
- void remove_nodes_and_delete(const string &);
+ XMLNode(const std::string& name);
+ XMLNode(const std::string& name, const std::string& content);
+ XMLNode(const XMLNode& other);
+ ~XMLNode();
+
+ XMLNode& operator= (const XMLNode& other);
+
+ const std::string& name() const { return _name; }
+
+ bool is_content() const { return _is_content; }
+ const std::string& content() const { return _content; }
+ const std::string& set_content(const std::string&);
+ XMLNode* add_content(const std::string& s = std::string());
+
+ const XMLNodeList& children(const std::string& str = std::string()) const;
+ XMLNode* child(const char*) const;
+ XMLNode* add_child(const char *);
+ XMLNode* add_child_copy(const XMLNode&);
+ void add_child_nocopy(XMLNode&);
+
+ std::string attribute_value();
+
+ const XMLPropertyList& properties() const { return _proplist; }
+ XMLProperty* property(const char*);
+ XMLProperty* property(const std::string&);
+ const XMLProperty* property(const char* n) const { return const_cast<XMLNode*>(this)->property(n); }
+ const XMLProperty* property(const std::string& n) const { return const_cast<XMLNode*>(this)->property(n); }
+
+ XMLProperty* add_property(const char* name, const std::string& value);
+ XMLProperty* add_property(const char* name, const char* value = "");
+ XMLProperty* add_property(const char* name, const long value);
+
+ void remove_property(const std::string&);
+ void remove_property_recursively(const std::string&);
+
+ /** Remove all nodes with the name passed to remove_nodes */
+ void remove_nodes(const std::string&);
+ /** Remove and delete all nodes with the name passed to remove_nodes */
+ void remove_nodes_and_delete(const std::string&);
+ /** Remove and delete all nodes with property prop matching val */
+ void remove_nodes_and_delete(const std::string& propname, const std::string& val);
+
+ void dump (std::ostream &, std::string p = "") const;
+
+private:
+ std::string _name;
+ bool _is_content;
+ std::string _content;
+ XMLNodeList _children;
+ XMLPropertyList _proplist;
+ XMLPropertyMap _propmap;
+ mutable XMLNodeList _selected_children;
+
+ void clear_lists ();