[glom] Document: Ensure that the xmlns ID is always in saved documents.



commit 9ada3c2f7e44033945ebe077f71785d8a3a18a30
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Nov 17 12:02:27 2009 +0100

    Document: Ensure that the xmlns ID is always in saved documents.
    
    * glom/libglom/document/bakery/document_xml.cc: get_node_document():
    Make sure that the xmlns ID is added, even when the root node already
    exists, for instance when opening existing documents.
    
    * examples/example_film_manager.glom:
    * examples/example_lesson_planner.glom:
    * examples/example_music_collection.glom:
    * examples/example_project_manager.glom:
    * examples/example_smallbusiness.glom:
    * examples/sqlite/test_sqlite_music/test_sqlite_music.glom:
    Add the xmnls ID, to help to identify the MIME type of these documents.

 ChangeLog                                          |   16 ++++++++++++++++
 examples/example_film_manager.glom                 |    2 +-
 examples/example_lesson_planner.glom               |    2 +-
 examples/example_music_collection.glom             |    2 +-
 examples/example_project_manager.glom              |    2 +-
 examples/example_smallbusiness.glom                |    2 +-
 .../test_sqlite_music/test_sqlite_music.glom       |    2 +-
 glom/libglom/document/bakery/document_xml.cc       |    9 ++++++---
 8 files changed, 28 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2c51912..77fa0a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2009-11-17  Murray Cumming  <murrayc murrayc com>
 
+	Document: Ensure that the xmlns ID is always in saved documents.
+
+	* glom/libglom/document/bakery/document_xml.cc: get_node_document():
+	Make sure that the xmlns ID is added, even when the root node already 
+	exists, for instance when opening existing documents.
+
+	* examples/example_film_manager.glom:
+	* examples/example_lesson_planner.glom:
+	* examples/example_music_collection.glom:
+	* examples/example_project_manager.glom:
+	* examples/example_smallbusiness.glom:
+	* examples/sqlite/test_sqlite_music/test_sqlite_music.glom:
+	Add the xmnls ID, to help to identify the MIME type of these documents.
+
+2009-11-17  Murray Cumming  <murrayc murrayc com>
+
 	Document saving: Remove unncessary empty singular_title nodes.
 
 	* glom/libglom/document/document.cc: save_before_translations(): 
diff --git a/examples/example_film_manager.glom b/examples/example_film_manager.glom
index 9204cc1..b5c8740 100644
--- a/examples/example_film_manager.glom
+++ b/examples/example_film_manager.glom
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<glom_document database_title="Openismus Film Manager" is_example="true" translation_original_locale="en_US" format_version="3">
+<glom_document xmlns="http://glom.org/glom_document"; database_title="Openismus Film Manager" is_example="true" translation_original_locale="en_US" format_version="3">
   <connection server="localhost" user="" database="glom_film_production_manager1" self_hosted="true" port="5435" try_other_ports="false" hosting_mode="postgres_self"/>
   <table name="accommodation" title="Accommodation">
     <example_rows/>
diff --git a/examples/example_lesson_planner.glom b/examples/example_lesson_planner.glom
index a4ffd86..6e7b54c 100644
--- a/examples/example_lesson_planner.glom
+++ b/examples/example_lesson_planner.glom
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<glom_document database_title="Lesson Planner" is_example="true" translation_original_locale="en_US" format_version="3">
+<glom_document xmlns="http://glom.org/glom_document"; database_title="Lesson Planner" is_example="true" translation_original_locale="en_US" format_version="3">
   <connection server="localhost" user="" database="glom_example_lessonplanner_v2" self_hosted="true" port="5435" try_other_ports="false" hosting_mode="postgres_self"/>
   <table name="invoice_lines" hidden="true">
     <example_rows>
diff --git a/examples/example_music_collection.glom b/examples/example_music_collection.glom
index 96fc4fe..6fee53b 100644
--- a/examples/example_music_collection.glom
+++ b/examples/example_music_collection.glom
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<glom_document translation_original_locale="en_US" database_title="Music Collection" is_example="true" format_version="3">
+<glom_document xmlns="http://glom.org/glom_document"; translation_original_locale="en_US" database_title="Music Collection" is_example="true" format_version="3">
   <connection server="localhost" database="glom_musiccollection21" port="5435" self_hosted="true" try_other_ports="false" hosting_mode="postgres_self"/>
   <table name="albums" overview_x="15" overview_y="9" title="Albums">
     <example_rows>
diff --git a/examples/example_project_manager.glom b/examples/example_project_manager.glom
index a2c38eb..b55f35d 100644
--- a/examples/example_project_manager.glom
+++ b/examples/example_project_manager.glom
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<glom_document database_title="Project Manager Example" is_example="true" translation_original_locale="en_US" format_version="3">
+<glom_document xmlns="http://glom.org/glom_document"; database_title="Project Manager Example" is_example="true" translation_original_locale="en_US" format_version="3">
   <connection server="localhost" user="" database="glom_example_project_manager_v2" self_hosted="true" port="5435" try_other_ports="false" hosting_mode="postgres_self"/>
   <table name="contacts" title="Contacts">
     <example_rows>
diff --git a/examples/example_smallbusiness.glom b/examples/example_smallbusiness.glom
index 6176b94..95341af 100644
--- a/examples/example_smallbusiness.glom
+++ b/examples/example_smallbusiness.glom
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<glom_document database_title="Small Business Example" is_example="true" translation_original_locale="en_US" format_version="4">
+<glom_document xmlns="http://glom.org/glom_document"; database_title="Small Business Example" is_example="true" translation_original_locale="en_US" format_version="4">
   <connection server="localhost" user="" database="glom_example_smallbusiness_v2" self_hosted="true" port="5434" try_other_ports="false" hosting_mode="postgres_self"/>
   <table name="contacts" default="true" title="Contacts">
     <example_rows>
diff --git a/examples/sqlite/test_sqlite_music/test_sqlite_music.glom b/examples/sqlite/test_sqlite_music/test_sqlite_music.glom
index 7cfb161..10a51e9 100644
--- a/examples/sqlite/test_sqlite_music/test_sqlite_music.glom
+++ b/examples/sqlite/test_sqlite_music/test_sqlite_music.glom
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<glom_document translation_original_locale="en_US" database_title="Music Collection" is_example="false" format_version="4">
+<glom_document xmlns="http://glom.org/glom_document"; translation_original_locale="en_US" database_title="Music Collection" is_example="false" format_version="4">
   <connection server="localhost" database="glom_musiccollection21" port="0" self_hosted="true" try_other_ports="true" hosting_mode="sqlite"/>
   <table name="albums" overview_x="15" overview_y="9" title="Albums">
     <fields>
diff --git a/glom/libglom/document/bakery/document_xml.cc b/glom/libglom/document/bakery/document_xml.cc
index 8692c84..18bda02 100644
--- a/glom/libglom/document/bakery/document_xml.cc
+++ b/glom/libglom/document/bakery/document_xml.cc
@@ -241,10 +241,13 @@ xmlpp::Element* Document_XML::get_node_document()
   if(!nodeRoot)
   {
     //Add it if it isn't there already:
-    return m_pDOM_Document->create_root_node(m_strRootNodeName, m_root_xmlns);
+    nodeRoot = m_pDOM_Document->create_root_node(m_strRootNodeName, m_root_xmlns);
   }
-  else
-    return nodeRoot;
+  
+  //Make sure that it has the root name name and xmlns:
+  nodeRoot->set_namespace_declaration(m_root_xmlns);
+
+  return nodeRoot;
 }
 
 void Document_XML::set_write_formatted(bool formatted)



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