Added detach() method to strip off a root parent element, fixed bug in namespace...
[shibboleth/cpp-xmltooling.git] / xmltooling / XMLObject.h
index 21715e9..cc8e54b 100644 (file)
@@ -62,6 +62,18 @@ namespace xmltooling {
         virtual XMLObject* clone() const=0;\r
         \r
         /**\r
+         * Specialized function for detaching a child object from its parent\r
+         * <strong>while disposing of the parent</strong>.\r
+         *\r
+         * This is not a generic way of detaching any child object, but only of\r
+         * pruning a single child from the root of an XMLObject tree. If the\r
+         * detached XMLObject's parent is itself a child, an exception will be\r
+         * thrown. It's mainly useful for turning a child into the new root of\r
+         * the tree without having to clone the child.\r
+         */\r
+        virtual void detach()=0;\r
+\r
+        /**\r
          * Gets the QName for this element.  This QName <strong>MUST</strong> \r
          * contain the namespace URI, namespace prefix, and local element name.\r
          * \r
@@ -150,6 +162,15 @@ namespace xmltooling {
         virtual const std::list<XMLObject*>& getOrderedChildren() const=0;\r
 \r
         /**\r
+         * Used by a child's detach method to isolate the child from\r
+         * this parent object in preparation for destroying the parent\r
+         * (this object).\r
+         * \r
+         * @param child the child object to remove\r
+         */\r
+        virtual void removeChild(XMLObject* child)=0;\r
+\r
+        /**\r
          * Gets the DOM representation of this XMLObject, if one exists.\r
          * \r
          * @return the DOM representation of this XMLObject\r