Sort out xmlns stuff.
[libcxml.git] / src / cxml.h
index 1c98bbf237e18d119db87f48e2ac18397abaa790..993a662eed99bc88ce9121e3211e7b5a152e80b8 100644 (file)
@@ -69,6 +69,7 @@ class Node;
 typedef boost::shared_ptr<cxml::Node> NodePtr;
 typedef std::list<NodePtr> NodeList;   
 typedef boost::shared_ptr<const cxml::Node> ConstNodePtr;
+typedef std::list<std::pair<std::string, std::string> > KeyValueList;
 
 class Node
 {
@@ -185,6 +186,7 @@ public:
        NodeList children () const;
        NodeList children (std::string) const;
 
+       
        /** Add a child node with a given name */
        NodePtr add_child (std::string name, std::string namespace_prefix = "")
        {
@@ -194,17 +196,26 @@ public:
                _children.push_back (n);
                return n;
        }
-       
+
+       void set_namespace_declaration (std::string uri, std::string prefix = "");
+
+       KeyValueList namespace_declarations () const {
+               return _namespace_declarations;
+       }
+
        void set_content (std::string c) {
                _content = c;
        }
        
        /** @return The content of this node */
        std::string content () const;
+
        void set_attribute (std::string name, std::string value);
+
        void set_namespace_prefix (std::string p) {
                _namespace_prefix = p;
        }
+       
        /** @return namespace prefix of this node */
        std::string namespace_prefix () const;
        /** This will mark a child as to be ignored when calling done() */
@@ -237,7 +248,8 @@ private:
        std::string _name;
        std::string _content;
        std::string _namespace_prefix;
-       std::list<std::pair<std::string, std::string> > _attributes;
+       KeyValueList _attributes;
+       KeyValueList _namespace_declarations;
        mutable std::list<std::string> _taken;
 };