[gxml/serialization: 8/10] Fixed serialization and Element.content property



commit f1ace6c4a21d46907932d875a647a5f6d8cd0121
Author: Daniel Espinosa <esodan gmail com>
Date:   Tue Jul 23 18:04:48 2013 -0500

    Fixed serialization and Element.content property

 gxml/Element.vala                 |    2 +-
 gxml/Serializable.vala            |    7 ++++---
 gxml/SerializableObjectModel.vala |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gxml/Element.vala b/gxml/Element.vala
index 09ffef8..582fa96 100644
--- a/gxml/Element.vala
+++ b/gxml/Element.vala
@@ -532,7 +532,7 @@ namespace GXml {
                                // TODO: check impact on existing child nodes; they will be
                                //       detached, right?
                                // TODO: is XML in value interpreted or escaped?
-                               base.node->set_content (value);
+                               base.node->add_content (value);
                        }
                }
        }
diff --git a/gxml/Serializable.vala b/gxml/Serializable.vala
index be0dbe2..2b03fc8 100644
--- a/gxml/Serializable.vala
+++ b/gxml/Serializable.vala
@@ -115,13 +115,14 @@ namespace GXml {
                                doc = node.owner_document;
                        GLib.message ("Serialing on ..." + node.node_name);
                        var element = doc.create_element (this.get_type().name());
+                       node.append_child (element);
+                       GLib.message ("Is NULL VALUE ?" + (serialized_xml_node_value == null).to_string ());
+                       if (serialized_xml_node_value != null)
+                               element.content = serialized_xml_node.content;
                        foreach (ParamSpec spec in list_serializable_properties ()) {
                                GLib.message ("Property to Serialize: " + spec.name);
                                serialize_property (element, spec);
                        }
-                       if (serialized_xml_node_value != null)
-                               serialized_xml_node.content = serialized_xml_node_value;
-                       node.append_child (element);
                        GLib.message ("Added a new top node" + serialized_xml_node.node_name);
                        return serialized_xml_node;
                }
diff --git a/gxml/SerializableObjectModel.vala b/gxml/SerializableObjectModel.vala
index 366956b..75918cd 100644
--- a/gxml/SerializableObjectModel.vala
+++ b/gxml/SerializableObjectModel.vala
@@ -32,7 +32,7 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
        /* No serializable properties */
        [Description (blurb="GXml.DomNode contents")]
        public string @value {
-               get { return serialized_xml_node_value; } 
+               owned get { return serialized_xml_node_value; } 
                set { serialized_xml_node_value = value; }
        }
        public SerializableObjectModel ()


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