[glom/feature_backup2] DTD: Mention the startup_script node.



commit 9b75d8ae1e2dd4c4bd04f6c255fd9f9b68ecf6ea
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jul 22 13:18:39 2010 +0200

    DTD: Mention the startup_script node.
    
    	* glom/glom_document.dtd: Add the startup_script node, so that
      the examples validate again.
    	* glom/libglom/document/document.cc: set_child_text_node():
      Do not add new empty nodes. This keeps the document smaller.

 glom/glom_document.dtd            |    5 ++++-
 glom/libglom/document/document.cc |    5 +++++
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/glom/glom_document.dtd b/glom/glom_document.dtd
index 6ab2fc5..da0e55e 100644
--- a/glom/glom_document.dtd
+++ b/glom/glom_document.dtd
@@ -15,7 +15,7 @@ TODO: Add 'title_singular' element.
   format_version: The version of this document's format. Older versions of Glom cannot open documents saved in newer versions of the document format.
   is_example: Whether this is an example document. Opening an example document causes a new database (and document) to be created.
 -->
-    <!ELEMENT glom_document (connection?, table*, groups?, library_modules?) >
+    <!ELEMENT glom_document (connection?, startup_script?, table*, groups?, library_modules?) >
     <!ATTLIST glom_document
         xmlns CDATA #IMPLIED
         database_title CDATA #IMPLIED
@@ -44,6 +44,9 @@ TODO: Add 'title_singular' element.
         hosting_mode CDATA #IMPLIED
         network_shared (true|false) "false">
 
+    <!ELEMENT startup_script (#PCDATA)>
+    <!ATTLIST startup_script>
+
 <!-- group(s) and table_privs are the permissions for each table.
       However, these are just initial permissions for examples. The real permissions are
       always in the database.
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 3b778b8..116ec47 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -1115,7 +1115,12 @@ void Document::set_child_text_node(xmlpp::Element* node, const Glib::ustring& ch
 {
   xmlpp::Element* child = get_node_child_named(node, child_node_name);
   if(!child)
+  {
+    if(text.empty())
+      return; //Keep the document smaller by avoiding empty nodes.
+
     child = node->add_child(child_node_name);
+  }
 
   xmlpp::TextNode* text_child = child->get_child_text();
   if(!text_child)



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