[libxml++] My proposed patches



The first patch adds cobj() to Document.  The second one adds the
function Document::create_root_node_by_import.  I decided to leave the
long name and not overload create_root_node for the sake of clarity; in
the same manner, Node::import_node and Node::add_child are two
differently named functions with analogous functionality.

If you give me the word, I'll go ahead and commit it to the module, or
feel free to do it on your own.

Thanks,
Jim
Index: libxml++/document.cc
===================================================================
RCS file: /cvs/gnome/libxml++/libxml++/document.cc,v
retrieving revision 1.3
diff -u -w -r1.3 document.cc
--- libxml++/document.cc	13 Jan 2004 15:23:23 -0000	1.3
+++ libxml++/document.cc	5 Feb 2004 01:08:17 -0000
@@ -321,4 +321,14 @@
   return xmlGetDocEntity(impl_, (const xmlChar*) name.c_str());
 }
 
+_xmlDoc* Document::cobj()
+{
+  return impl_;
+}
+
+const _xmlDoc* Document::cobj() const
+{
+  return impl_;
+}
+
 } //namespace xmlpp
Index: libxml++/document.h
===================================================================
RCS file: /cvs/gnome/libxml++/libxml++/document.h,v
retrieving revision 1.2
diff -u -w -r1.2 document.h
--- libxml++/document.h	19 Dec 2003 18:52:08 -0000	1.2
+++ libxml++/document.h	5 Feb 2004 01:08:18 -0000
@@ -147,6 +147,12 @@
                                       const Glib::ustring& publicId, const Glib::ustring& systemId,
                                       const Glib::ustring& content);
 
+  ///Access the underlying libxml implementation.
+  _xmlDoc* cobj();
+
+  ///Access the underlying libxml implementation.
+  const _xmlDoc* cobj() const;
+
 protected:
   /** Retrieve an Entity.
    * The entity can be from an external subset or internally declared.
Index: libxml++/document.cc
===================================================================
RCS file: /cvs/gnome/libxml++/libxml++/document.cc,v
retrieving revision 1.3
diff -r1.3 document.cc
226a227,239
> Element* Document::create_root_node_by_import(const Node* node,
> 					      bool recursive)
> {
>   //Create the node, by copying:
>   xmlNode* imported_node = xmlDocCopyNode(const_cast<xmlNode*>(node->cobj()), impl_, recursive);
>   if (!imported_node)
>     throw exception("Unable to import node");
> 
>   xmlDocSetRootElement(impl_, imported_node);
> 
>   return get_root_node();
> }
> 
Index: libxml++/document.h
===================================================================
RCS file: /cvs/gnome/libxml++/libxml++/document.h,v
retrieving revision 1.2
diff -r1.2 document.h
82a83
>    * @return A pointer to the new root node
87a89,96
>   /** Creates a root node by importing the node from another document, without affecting the source node.
>    * @param node The node to copy and insert as the root node of the document
>    * @param recursive Whether to import the child nodes also. Defaults to true.
>    * @return A pointer to the new root node
>    */
>   Element* create_root_node_by_import(const Node* node,
> 				      bool recursive = true);
> 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]