[gxml] Fixed Unit Tests /gxml/serializable/object_model/unknown_property
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Fixed Unit Tests /gxml/serializable/object_model/unknown_property
- Date: Fri, 8 May 2015 22:48:39 +0000 (UTC)
commit 67d67f8f0dfe666787b59646c7cde223c3bcd5cb
Author: Daniel Espinosa <esodan gmail com>
Date: Thu May 7 15:34:18 2015 -0500
Fixed Unit Tests /gxml/serializable/object_model/unknown_property
gxml/Serializable.vala | 41 ++++++++++++++---
gxml/SerializableGeeArrayList.vala | 24 +++++++++-
gxml/SerializableGeeDualKeyMap.vala | 23 +++++++++-
gxml/SerializableGeeHashMap.vala | 23 +++++++++-
gxml/SerializableGeeTreeMap.vala | 23 +++++++++-
gxml/SerializableJson.vala | 26 ++++++++++-
gxml/SerializableObjectModel.vala | 57 ++++++++++++++++++++----
test/SerializableGeeCollectionsTest.vala | 6 +-
test/SerializableObjectModelTest.vala | 70 ++++++++++++++++++++++++------
9 files changed, 252 insertions(+), 41 deletions(-)
---
diff --git a/gxml/Serializable.vala b/gxml/Serializable.vala
index 94f58a4..9437754 100644
--- a/gxml/Serializable.vala
+++ b/gxml/Serializable.vala
@@ -20,6 +20,8 @@
* Daniel Espinosa <esodan gmail com>
*/
+using Gee;
+
namespace GXml {
/**
* Serialization framework. Base interface.
@@ -59,27 +61,51 @@ namespace GXml {
*/
public abstract bool get_enable_unknown_serializable_property ();
/**
- * On deserialization stores any { link GXml.Node} not used on this
+ * On deserialization stores any { link GXml.Attribute} not used on this
* object, but exists in current XML file.
*
- * Node's name is used as key to find stored { link GXml.Node}.
+ * Node's name is used as key to find stored { link GXml.Attribute}, key is
+ * case sensitive.
*
* XML allows great flexibility, providing different ways to represent the same
* information. This is a problem when you try to deserialize them.
*
* In order to deserialize correctly, you must create your XML, both by
* serializing a { link Serializable} object or by hand writing. By using the
- * former, you can add extra information, like nodes or properties, but most of
+ * former, you can add extra information, like attributes, but most of
* them could be ignored or lost on deserialization/serialization process. To
* avoid data lost, you can override { link get_enable_unknown_serializable_property}
* method in order to return true, your implementation or the ones in GXml, will
+ * store all unknown attributes on deserialization and must serialize
+ * again back to the XML file. Even you are allowed to get this unknown objects
+ * by iterating on { link unknown_serializable_property} collection, if you know
+ * attribute's name, use it to retrieve it.
+ *
+ * This property is ignored on serialisation.
+ */
+ public abstract Gee.Map<string,GXml.Attribute> unknown_serializable_property { get; protected set; }
+
+
+ /**
+ * On deserialization stores any { link GXml.Node} not used on this
+ * object, but exists in current XML file.
+ *
+ * XML allows great flexibility, providing different ways to represent the same
+ * information. This is a problem when you try to deserialize them.
+ *
+ * In order to deserialize correctly, you must create your XML, both by
+ * serializing a { link Serializable} object or by hand writing. By using the
+ * former, you can add extra information, like nodes or contents in known nodes,
+ * but most of them could be ignored or lost on deserialization/serialization process.
+ * To avoid data lost, you can override { link get_enable_unknown_serializable_property}
+ * method in order to return true, your implementation or the ones in GXml, will
* store all unknown properties and nodes on deserialization and must serialize
* again back to the XML file. Even you are allowed to get this unknown objects
* by iterating on { link unknown_serializable_property} hash table.
*
* This property is ignored on serialisation.
- */
- public abstract HashTable<string,GXml.Node> unknown_serializable_property { get; protected set; }
+ */
+ public abstract Gee.Collection<GXml.Node> unknown_serializable_nodes { get; protected set; }
/**
* Used to add content in an { link GXml.Element}.
@@ -312,14 +338,13 @@ namespace GXml {
get_class ().find_property("ignored-serializable-properties"));
ignored_serializable_properties.set ("unknown-serializable-property",
get_class ().find_property("unknown-serializable-property"));
+ ignored_serializable_properties.set ("unknown-serializable-nodes",
+ get_class ().find_property("unknown-serializable-nodes"));
ignored_serializable_properties.set ("serialized-xml-node-value",
get_class ().find_property("serialized-xml-node-value"));
ignored_serializable_properties.set ("serialize-set-namespace",
get_class ().find_property("serialize_set_namespace"));
}
- if (unknown_serializable_property == null) {
- unknown_serializable_property = new HashTable<string,GXml.Node> (str_hash, str_equal);
- }
}
/**
diff --git a/gxml/SerializableGeeArrayList.vala b/gxml/SerializableGeeArrayList.vala
index 35c527d..ab3e849 100644
--- a/gxml/SerializableGeeArrayList.vala
+++ b/gxml/SerializableGeeArrayList.vala
@@ -30,13 +30,33 @@ using Gee;
*/
public class GXml.SerializableArrayList<G> : Gee.ArrayList<G>, Serializable, SerializableCollection
{
+ Gee.HashMap<string,GXml.Attribute> _unknown_serializable_property = new Gee.HashMap<string,GXml.Attribute>
();
+ Gee.ArrayList<GXml.Node> _unknown_serializable_nodes = new Gee.ArrayList<GXml.Node> ();
+ public Gee.Map<string,GXml.Attribute> unknown_serializable_property
+ {
+ get {
+ return _unknown_serializable_property;
+ }
+ protected set {
+ if (value is Gee.HashMap)
+ _unknown_serializable_property = (Gee.HashMap<string,GXml.Attribute>) value;
+ }
+ }
+ public Gee.Collection<GXml.Node> unknown_serializable_nodes
+ {
+ get {
+ return _unknown_serializable_nodes;
+ }
+ protected set {
+ if (value is Gee.ArrayList)
+ _unknown_serializable_nodes = (Gee.ArrayList<GXml.Node>) value;
+ }
+ }
protected ParamSpec[] properties { get; set; }
public GLib.HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
public string? serialized_xml_node_value { get; protected set; default=null; }
public virtual bool set_namespace (GXml.Node node) { return true; }
- public GLib.HashTable<string,GXml.xNode> unknown_serializable_property { get; protected set; }
-
public bool get_enable_unknown_serializable_property () { return false; }
public virtual bool serialize_use_xml_node_value () { return false; }
public virtual bool property_use_nick () { return false; }
diff --git a/gxml/SerializableGeeDualKeyMap.vala b/gxml/SerializableGeeDualKeyMap.vala
index f6306c8..ef67225 100644
--- a/gxml/SerializableGeeDualKeyMap.vala
+++ b/gxml/SerializableGeeDualKeyMap.vala
@@ -112,11 +112,32 @@ public class GXml.SerializableDualKeyMap<P,S,V> : Object, Serializable, Serializ
storage = new Gee.HashMultiMap<P,HashMap<S,V>> ();
}
// Serializable Interface
+ Gee.HashMap<string,GXml.Attribute> _unknown_serializable_property = new Gee.HashMap<string,GXml.Attribute>
();
+ Gee.ArrayList<GXml.Node> _unknown_serializable_nodes = new Gee.ArrayList<GXml.Node> ();
+ public Gee.Map<string,GXml.Attribute> unknown_serializable_property
+ {
+ get {
+ return _unknown_serializable_property;
+ }
+ protected set {
+ if (value is Gee.HashMap)
+ _unknown_serializable_property = (Gee.HashMap<string,GXml.Attribute>) value;
+ }
+ }
+ public Gee.Collection<GXml.Node> unknown_serializable_nodes
+ {
+ get {
+ return _unknown_serializable_nodes;
+ }
+ protected set {
+ if (value is Gee.ArrayList)
+ _unknown_serializable_nodes = (Gee.ArrayList<GXml.Node>) value;
+ }
+ }
protected ParamSpec[] properties { get; set; }
public GLib.HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
public string? serialized_xml_node_value { get; protected set; default=null; }
public virtual bool set_namespace (GXml.Node node) { return true; }
- public GLib.HashTable<string,GXml.xNode> unknown_serializable_property { get; protected set; }
public virtual bool get_enable_unknown_serializable_property () { return false; }
public virtual bool serialize_use_xml_node_value () { return false; }
diff --git a/gxml/SerializableGeeHashMap.vala b/gxml/SerializableGeeHashMap.vala
index 3b1bb4e..92b294e 100644
--- a/gxml/SerializableGeeHashMap.vala
+++ b/gxml/SerializableGeeHashMap.vala
@@ -28,11 +28,32 @@ using GXml;
*/
public class GXml.SerializableHashMap<K,V> : Gee.HashMap<K,V>, Serializable, SerializableCollection
{
+ Gee.HashMap<string,GXml.Attribute> _unknown_serializable_property = new Gee.HashMap<string,GXml.Attribute>
();
+ Gee.ArrayList<GXml.Node> _unknown_serializable_nodes = new Gee.ArrayList<GXml.Node> ();
+ public Gee.Map<string,GXml.Attribute> unknown_serializable_property
+ {
+ get {
+ return _unknown_serializable_property;
+ }
+ protected set {
+ if (value is Gee.HashMap)
+ _unknown_serializable_property = (Gee.HashMap<string,GXml.Attribute>) value;
+ }
+ }
+ public Gee.Collection<GXml.Node> unknown_serializable_nodes
+ {
+ get {
+ return _unknown_serializable_nodes;
+ }
+ protected set {
+ if (value is Gee.ArrayList)
+ _unknown_serializable_nodes = (Gee.ArrayList<GXml.Node>) value;
+ }
+ }
protected ParamSpec[] properties { get; set; }
public GLib.HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
public string? serialized_xml_node_value { get; protected set; default=null; }
public virtual bool set_namespace (GXml.Node node) { return true; }
- public GLib.HashTable<string,GXml.xNode> unknown_serializable_property { get; protected set; }
public virtual bool get_enable_unknown_serializable_property () { return false; }
public virtual bool serialize_use_xml_node_value () { return false; }
diff --git a/gxml/SerializableGeeTreeMap.vala b/gxml/SerializableGeeTreeMap.vala
index c0639d6..6f627d2 100644
--- a/gxml/SerializableGeeTreeMap.vala
+++ b/gxml/SerializableGeeTreeMap.vala
@@ -28,11 +28,32 @@ using GXml;
*/
public class GXml.SerializableTreeMap<K,V> : Gee.TreeMap<K,V>, Serializable, SerializableCollection
{
+ Gee.HashMap<string,GXml.Attribute> _unknown_serializable_property = new Gee.HashMap<string,GXml.Attribute>
();
+ Gee.ArrayList<GXml.Node> _unknown_serializable_nodes = new Gee.ArrayList<GXml.Node> ();
+ public Gee.Map<string,GXml.Attribute> unknown_serializable_property
+ {
+ get {
+ return _unknown_serializable_property;
+ }
+ protected set {
+ if (value is Gee.HashMap)
+ _unknown_serializable_property = (Gee.HashMap<string,GXml.Attribute>) value;
+ }
+ }
+ public Gee.Collection<GXml.Node> unknown_serializable_nodes
+ {
+ get {
+ return _unknown_serializable_nodes;
+ }
+ protected set {
+ if (value is Gee.ArrayList)
+ _unknown_serializable_nodes = (Gee.ArrayList<GXml.Node>) value;
+ }
+ }
protected ParamSpec[] properties { get; set; }
public GLib.HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
public string? serialized_xml_node_value { get; protected set; default=null; }
public virtual bool set_namespace (GXml.Node node) { return true; }
- public GLib.HashTable<string,GXml.xNode> unknown_serializable_property { get; protected set; }
public bool get_enable_unknown_serializable_property () { return false; }
public virtual bool serialize_use_xml_node_value () { return false; }
diff --git a/gxml/SerializableJson.vala b/gxml/SerializableJson.vala
index e3af274..86c99e9 100644
--- a/gxml/SerializableJson.vala
+++ b/gxml/SerializableJson.vala
@@ -60,10 +60,11 @@
*/
public class GXml.SerializableJson : GLib.Object, GXml.Serializable
{
+ Gee.HashMap<string,GXml.Attribute> _unknown_serializable_property = new Gee.HashMap<string,GXml.Attribute>
();
+ Gee.ArrayList<GXml.Node> _unknown_serializable_nodes = new Gee.ArrayList<GXml.Node> ();
/* Serializable Interface properties */
protected ParamSpec[] properties { get; set; }
public HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
- public HashTable<string,GXml.Node> unknown_serializable_property { get; protected set; }
public virtual bool get_enable_unknown_serializable_property () { return false; }
public string? serialized_xml_node_value { get; protected set; default = null; }
public virtual bool set_namespace (GXml.Node node) { return true; }
@@ -72,6 +73,27 @@ public class GXml.SerializableJson : GLib.Object, GXml.Serializable
public virtual string node_name () { return "Object"; }
public virtual bool property_use_nick () { return false; }
+ public Gee.Map<string,GXml.Attribute> unknown_serializable_property
+ {
+ get {
+ return _unknown_serializable_property;
+ }
+ protected set {
+ if (value is Gee.HashMap)
+ _unknown_serializable_property = (Gee.HashMap<string,GXml.Attribute>) value;
+ }
+ }
+ public Gee.Collection<GXml.Node> unknown_serializable_nodes
+ {
+ get {
+ return _unknown_serializable_nodes;
+ }
+ protected set {
+ if (value is Gee.ArrayList)
+ _unknown_serializable_nodes = (Gee.ArrayList<GXml.Node>) value;
+ }
+ }
+
public virtual GLib.ParamSpec? find_property_spec (string property_name)
{
return default_find_property_spec (property_name);
@@ -258,7 +280,7 @@ public class GXml.SerializableJson : GLib.Object, GXml.Serializable
if (spec == null) {
GLib.message ("Deserializing object of type '%s' claimed unknown property named '%s'\nXML [%s]",
ptype, pname, property_node.stringify ());
- unknown_serializable_property.set (property_node.node_name, property_node);
+ unknown_serializable_property.set (property_node.node_name, (GXml.Attribute) property_node);
}
else {
if (spec.value_type.is_a (typeof(Serializable)))
diff --git a/gxml/SerializableObjectModel.vala b/gxml/SerializableObjectModel.vala
index 4eaac7f..399a46f 100644
--- a/gxml/SerializableObjectModel.vala
+++ b/gxml/SerializableObjectModel.vala
@@ -20,6 +20,8 @@
* Daniel Espinosa <esodan gmail com>
*/
+using Gee;
+
/**
* Object Model is an { link Serializable} implementation using { link Element}
* to represent { link GLib.Object} class objects.
@@ -35,12 +37,33 @@
*/
public abstract class GXml.SerializableObjectModel : Object, Serializable
{
+ Gee.HashMap<string,GXml.Attribute> _unknown_serializable_property = new Gee.HashMap<string,GXml.Attribute>
();
+ Gee.ArrayList<GXml.Node> _unknown_serializable_nodes = new Gee.ArrayList<GXml.Node> ();
/* Serializable interface properties */
protected ParamSpec[] properties { get; set; }
public GLib.HashTable<string,GLib.ParamSpec> ignored_serializable_properties { get; protected set; }
public string? serialized_xml_node_value { get; protected set; default=null; }
public virtual bool get_enable_unknown_serializable_property () { return false; }
- public GLib.HashTable<string,GXml.Node> unknown_serializable_property { get; protected set; }
+ public Gee.Map<string,GXml.Attribute> unknown_serializable_property
+ {
+ get {
+ return _unknown_serializable_property;
+ }
+ protected set {
+ if (value is Gee.HashMap)
+ _unknown_serializable_property = (Gee.HashMap<string,GXml.Attribute>) value;
+ }
+ }
+ public Gee.Collection<GXml.Node> unknown_serializable_nodes
+ {
+ get {
+ return _unknown_serializable_nodes;
+ }
+ protected set {
+ if (value is Gee.ArrayList)
+ _unknown_serializable_nodes = (Gee.ArrayList<GXml.Node>) value;
+ }
+ }
public virtual bool serialize_use_xml_node_value () { return false; }
public virtual bool property_use_nick () { return false; }
@@ -117,18 +140,24 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
serialize_property (element, spec);
}
if (get_enable_unknown_serializable_property ()) {
- foreach (GXml.Node n in unknown_serializable_property.get_values ()) {
+ // Serializing unknown Attributes
+ foreach (GXml.Attribute attr in unknown_serializable_property.values) {
+ element.set_attr (attr.name, attr.value); // TODO: Namespace
+ }
+ // Serializing unknown Nodes
+ foreach (GXml.Node n in unknown_serializable_nodes) {
if (n is GXml.Element) {
var e = doc.create_element (n.name);
GXml.Node.copy (node.document, e, n, true);
element.childs.add (e);
}
- if (n is Attr) {
- element.set_attr (n.name, n.value); // TODO: Namespace
- }
if (n is Text) {
- var tnode = doc.create_text (n.value);
- element.childs.add (tnode);
+ // If no Element contents is recognized add contents
+ if (!serialize_use_xml_node_value ()) {
+ if (element.content == null)
+ element.content = "";
+ element.content += n.value;
+ }
}
}
}
@@ -294,7 +323,7 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
} else {
if (get_enable_unknown_serializable_property ()) {
if (n.value._chomp () == n.value && n.value != "")
- unknown_serializable_property.set (n.name, n);
+ unknown_serializable_nodes.add (n);
}
}
}
@@ -325,10 +354,18 @@ public abstract class GXml.SerializableObjectModel : Object, Serializable
if (prop == null) {
// FIXME: Event emit
if (get_enable_unknown_serializable_property ()) {
+ if (property_node is GXml.Attribute) {
#if DEBUG
- GLib.message (@"Adding unknown node $(property_node.name) to $(get_type ().name ())\n");
+ GLib.message (@"Adding unknown attribute $(property_node.name) to $(get_type ().name ())\n");
#endif
- unknown_serializable_property.set (property_node.name, property_node);
+ unknown_serializable_property.set (property_node.name, (GXml.Attribute) property_node);
+ }
+ if (property_node is GXml.Element) {
+ unknown_serializable_nodes.add (property_node);
+#if DEBUG
+ GLib.message (@"Adding unknown node $(property_node.name) to $(get_type ().name ()):
Size=$(unknown_serializable_nodes.size.to_string ())");
+#endif
+ }
}
return true;
}
diff --git a/test/SerializableGeeCollectionsTest.vala b/test/SerializableGeeCollectionsTest.vala
index 775ddea..8e4f7fc 100644
--- a/test/SerializableGeeCollectionsTest.vala
+++ b/test/SerializableGeeCollectionsTest.vala
@@ -489,9 +489,9 @@ class SerializableGeeCollectionsTest : GXmlTest
stdout.printf (@"ERROR: Refaction: No unknown properties/nodes found!\n");
assert_not_reached ();
}
- if (refaction.unknown_serializable_property.size () != 1) {
- stdout.printf (@"ERROR: Refaction: Bad unknown properties/nodes number: found
$(refaction.unknown_serializable_property.size ())\n");
- foreach (GXml.Node unk in refaction.unknown_serializable_property.get_values ())
+ if (refaction.unknown_serializable_property.size != 1) {
+ stdout.printf (@"ERROR: Refaction: Bad unknown properties/nodes number: found
$(refaction.unknown_serializable_property.size)\n");
+ foreach (GXml.Node unk in refaction.unknown_serializable_property.values)
{
string unkv = "___NULL__";
if (unk.value != null)
diff --git a/test/SerializableObjectModelTest.vala b/test/SerializableObjectModelTest.vala
index a8a6f67..3dbbbe6 100644
--- a/test/SerializableObjectModelTest.vala
+++ b/test/SerializableObjectModelTest.vala
@@ -148,7 +148,7 @@ public class Package : ObjectModel
public string unknown_to_string ()
{
string t = "";
- foreach (GXml.Node node in unknown_serializable_property.get_values ())
+ foreach (GXml.Attribute node in unknown_serializable_property.values)
{
t+= node.to_string () ;
}
@@ -817,9 +817,18 @@ class SerializableObjectModelTest : GXmlTest
var unknown_property = new UnknownAttribute ();
try {
unknown_property.deserialize (doc);
- if (unknown_property.unknown_serializable_property.size () != 4) {
- stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: size
$(unknown_property.unknown_serializable_property.size ().to_string ())\n");
- foreach (GXml.Node un in unknown_property.unknown_serializable_property.get_values
()) {
+#if DEBUG
+ foreach (GXml.Attribute a in unknown_property.unknown_serializable_property.values) {
+ GLib.message (@"Unknown Attribute: $(a.name) = $(a.value)");
+ }
+ foreach (GXml.Node un in unknown_property.unknown_serializable_nodes) {
+ GLib.message (@"Unknown Node: $(un.name) = $(un.to_string ())");
+ }
+#endif
+ assert (unknown_property.unknown_serializable_property.size == 2);
+ if (unknown_property.unknown_serializable_property.size != 2) {
+ stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: size
$(unknown_property.unknown_serializable_property.size.to_string ())\n");
+ foreach (GXml.Node un in unknown_property.unknown_serializable_property.values) {
string sv = "__NULL__";
if (un.value != null)
sv = un.value;
@@ -827,7 +836,7 @@ class SerializableObjectModelTest : GXmlTest
}
assert_not_reached ();
}
- if (!unknown_property.unknown_serializable_property.contains ("ignore")) {
+ if (!unknown_property.unknown_serializable_property.has_key ("ignore")) {
stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: ignore not found");
assert_not_reached ();
}
@@ -836,7 +845,7 @@ class SerializableObjectModelTest : GXmlTest
stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: ignore is not an GXml.Attr");
assert_not_reached ();
}
- if (!unknown_property.unknown_serializable_property.contains ("ignore2")) {
+ if (!unknown_property.unknown_serializable_property.has_key ("ignore2")) {
stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: ignore not found");
assert_not_reached ();
}
@@ -845,14 +854,26 @@ class SerializableObjectModelTest : GXmlTest
stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: ignore2 is not an GXml.Attr");
assert_not_reached ();
}
- if (!unknown_property.unknown_serializable_property.contains ("UnknownNode")) {
- stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: node UnknownNode not found");
- assert_not_reached ();
- }var unknown_node = unknown_property.unknown_serializable_property.get
("UnknownNode");
- if (!(unknown_node is xElement)) {
- stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: unknown node is not an GXml.xElement");
- assert_not_reached ();
+#if DEBUG
+ GLib.message (@"Unknown nodes = $(unknown_property.unknown_serializable_nodes.size)");
+#endif
+ assert (unknown_property.unknown_serializable_nodes.size == 2);
+ bool foundn = false;
+ bool foundt = false;
+ GXml.Node unkn;
+ foreach (GXml.Node n in unknown_property.unknown_serializable_nodes) {
+ if (n.name == "UnknownNode") {
+ foundn = true;
+ assert (n.attrs.get ("toignore") != null);
+ assert (n.attrs.get ("toignore").value == "true");
+ }
+ if (n is Text) {
+ foundt = true;
+ assert (n.value == "TEXT");
+ }
}
+ assert (foundn);
+ assert (foundt);
}
catch (GLib.Error e) {
stdout.printf (@"Error: $(e.message)");
@@ -1010,6 +1031,29 @@ class SerializableObjectModelTest : GXmlTest
assert_not_reached ();
}
});
+ Test.add_func ("/gxml/serializable/object_model/find-unknown_property", () => {
+ try {
+ var p = new Package ();
+ var doc = new xDocument.from_string ("""<?xml version="1.0"?>
+<PACKAGE source="Mexico/North" destiny="Brazil" Unknown="2/4.04">
+<manual document="Sales Card" pages="1">Selling Card Specification</manual>
+<Computer manufacturer="BoxingLAN" model="J24-EX9" cores="32" ghz="1.8"/>
+<Box size="1" volume="33.15" units="cm3" />
+UNKNOWN CONTENT
+</PACKAGE>""");
+ p.deserialize (doc);
+ assert (p.unknown_serializable_property != null);
+ var ukattr = p.unknown_serializable_property.get ("Unknown");
+ assert (ukattr != null);
+ assert (ukattr.name == "Unknown");
+ assert (ukattr.value == "2/4.04");
+ } catch (GLib.Error e) {
+#if DEBUG
+ GLib.message ("ERROR: "+e.message);
+#endif
+ assert_not_reached ();
+ }
+ });
}
static void serialize_manual_check (xElement element, Manual manual)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]