[gxml] Fixed SerializableObjectModel serialize Element content to TwDocument
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Fixed SerializableObjectModel serialize Element content to TwDocument
- Date: Thu, 7 May 2015 18:15:22 +0000 (UTC)
commit bb0e3fef88567522660d5020c2133ed18777e62c
Author: Daniel Espinosa <esodan gmail com>
Date: Thu May 7 09:53:55 2015 -0500
Fixed SerializableObjectModel serialize Element content to TwDocument
* SerializableObjectModel used to create a GXml.Text and add it to
a GXml.Element when serializing, not as a element's content. This
is fixed now, but breaks the use of GXml.Text added as a child to
a GXml.Element and renderer it as a content, take care!
gxml/SerializableObjectModel.vala | 5 ++---
gxml/TwDocument.vala | 5 +++++
test/gxml-performance.vala | 3 ---
3 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/gxml/SerializableObjectModel.vala b/gxml/SerializableObjectModel.vala
index d73d264..f999f00 100644
--- a/gxml/SerializableObjectModel.vala
+++ b/gxml/SerializableObjectModel.vala
@@ -138,11 +138,10 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
string t = "";
if (serialized_xml_node_value != null)
t = serialized_xml_node_value;
- var tn = doc.create_text (t);
+ var tn = element.content = t;
#if DEBUG
- stdout.printf (@"SETTING CONTENT FOR: $(get_type ().name ()): $(element.name): content '$t'\n");
+ stdout.printf (@"SET CONTENT FOR: $(get_type ().name ()): $(element.name): content '$t'\n");
#endif
- element.childs.add (tn);
}
return element;
}
diff --git a/gxml/TwDocument.vala b/gxml/TwDocument.vala
index fe78a30..57cefb1 100644
--- a/gxml/TwDocument.vala
+++ b/gxml/TwDocument.vala
@@ -170,5 +170,10 @@ public class GXml.TwDocument : GXml.TwNode, GXml.Document
if (size > 1500)
tw.flush ();
}
+ if (node is GXml.Text) {
+ size += tw.write_string (node.value);
+ if (size > 1500)
+ tw.flush ();
+ }
}
}
diff --git a/test/gxml-performance.vala b/test/gxml-performance.vala
index 717c396..a30f39d 100644
--- a/test/gxml-performance.vala
+++ b/test/gxml-performance.vala
@@ -159,8 +159,6 @@ public class Performance
bs.deserialize (d);
time = Test.timer_elapsed ();
Test.minimized_result (time, "standard deserialize/performance: %g seconds", time);
- var author = new Author ();
- GLib.message (@"Is Serializable $((author is Serializable).to_string ())");
assert (bs.name == "The Great Book");
assert (bs.books.size > 10);
var b = bs.books.first ();
@@ -170,7 +168,6 @@ public class Performance
assert (b.year == "2015");
assert (b.authors != null);
assert (b.authors.array != null);
- GLib.message (@"Authors: $(b.authors.array.size.to_string ())");
assert (b.authors.array.size == 2);
var a = b.authors.array.first ();
assert (a != null);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]