<object> : CookXml Core Tag


This tag can do three things:

  • Reference an id object (same as idref, but with "id:" prefix).
  • Reference a variable inside the variable object (same as varref, but with "var:" prefix).
  • Construct an arbitrary object that has a default constructor with the name of the class as the value for the constructor attribute of the element.

Constructor Attribute ( ctor )

There are three formats:

FormatDescription
id:nameReference the object with id "name".
var:nameReference the object with variable "name".
classNameConstruct the object using the default constructor.

Additional Notes

Usually one only uses this tag to construct a new object. It is easier to use idref and varref for the other two purposes.

Examples

In the following XML code, a new instance of foo.MyButton class is created using object tag. Then tag attribute is used to instruct CookXml to treat it as a button object. Lastly, set the object's text attribute to "OK".

<object ctor="foo.MyButton" tag="button" text="OK"/>