A class implementing Collection to store references to child DomElement of Collection.element, using an attribute in items as key or MappeableElement.get_map_key method if implemented by items to be added. If key is not defined in node, it is not added; but keeps it as a child node of actual Collection.element.
If GXml.Element to be added is of type
Collection.items_type and implements
MappeableElement, you should set GXml.HashMap.attribute_key to
null in order to use returned value of
MappeableElement.get_map_key as key.
public class YourObject : GXml.Element {
[Description (nick="::Name")]
public string name { get; set; }
}
public class YourList : GXml.HashMap {
construct {
try { initialize_with_key (typeof (YourObject),"Name"); }
catch (GLib.Error e) {
warning ("Initialization error for collection type: %s : %s"
.printf (get_type ().name(), e.message));
}
}
}