GXml.Object.set_instance_property – GXml-0.20 Reference Manual

# set_instance_property

## Description:

public virtual bool set_instance_property (string name)

Convenient method to set an instance of given property's name and initialize according to have same DomNode.owner_document and set its DomNode.parent_node to this appending it as a child. If property is a Collection it is initialize to use this as its Collection.element.

Instance is set to object's property.

Property should be a GXml.Element or Collection

While an object could be created and set to a Object's property, it is not correctly initialized by default. This method helps in the process.

If Object's property has been set, this method overwrite it.

    class NodeA : GXml.Object {
      construct { try { initialize ("NodeA"); } catch { warning ("Can't initialize); }
    }
    class NodeB : GXml.Object {
      public NodeA node { get; set; }
    }

    var nb = new NodeB ();
    nb.create_instance_property ("node");
    assert (nb.node != null);

Property's name can be canonical or its nick name, see find_object_property_name

Returns: true if property has been set and initialized, false otherwise.