[libxml++] Node::create_new_child_node(): Use the default namespace if none is specified.



commit 7647b633736dede3e9233f89501cb4a597e35718
Author: Mathias Lorente <mathias lorente free fr>
Date:   Tue Sep 6 09:50:19 2011 +0200

    Node::create_new_child_node(): Use the default namespace if none is specified.
    
    * libxml++/nodes/node.cc: This is better than just ignoring it.
    Bug #656110

 ChangeLog              |    7 +++++++
 libxml++/nodes/node.cc |    8 ++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4706c9f..9cb34b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-09-06  Mathias Lorente  <mathias lorente free fr>
+
+	Node::create_new_child_node(): Use the default namespace if none is specified.
+
+	* libxml++/nodes/node.cc: This is better than just ignoring it.
+	Bug #656110
+
 2011-07-20  Murray Cumming  <murrayc murrayc com>
 
 	ContentNode::get_content(): Fix a documentation typo.
diff --git a/libxml++/nodes/node.cc b/libxml++/nodes/node.cc
index e9b5402..bc56266 100644
--- a/libxml++/nodes/node.cc
+++ b/libxml++/nodes/node.cc
@@ -164,8 +164,12 @@ _xmlNode* Node::create_new_child_node(const Glib::ustring& name, const Glib::ust
       #endif //LIBXMLCPP_EXCEPTIONS_ENABLED
    }
 
-   //Ignore the namespace if none was specified:
-   if(!ns_prefix.empty())
+   if(ns_prefix.empty())
+   {
+     //Retrieve default namespace if it exists
+     ns = xmlSearchNs(impl_->doc, impl_, 0);
+   }
+   else
    {
      //Use the existing namespace if one exists:
      ns = xmlSearchNs(impl_->doc, impl_, (const xmlChar*)ns_prefix.c_str());



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