<node>

Purpose The <node> statement is used to instantiate (i.e. create) an object. The object will exist in the run-time memory once it is instantiated.
Format <node name="{object name}" class="{parent classes}"
   processcode="{boolVal}" construct="{true/false}">
   {child nodes}
</node>

{object name} the name of the object being instantiated
{parent classes} (optional) a comma-separated list of the names of the parent classes to be inherited from. If no class names are present then the object is instantiated as an instance of the Node class.
{boolVal} (optional) a boolean value of true or false that specifies whether or not Superx++ statements enclosed in the {child nodes} of the <node> statement are to be processed before being embedded in the object. The default value is false.
{construct} (optional) true or false value that specifies whether or not the constructor method and the <construct> clause will be executed for the object.
{child nodes} (optional) the nodes to be instantiated as descendants of the object. These nodes are not the same as those derived from the inheritance via the class attribute. These nodes represent customizations in the instantiation of individual objects of a class. This phenomenon is called customized instantiation and is useful in modeling exceptional cases that evolve in real life or real systems.
Changes for beta 0.2.2
The <node> statement now has a construct attribute which can have a value of true or false. The default value of the construct attribute is true. So if you omit the construct attribute then it is as if you had specified a value of true. If the construct attribute is valued as true then when the object is created the constructor method of the object's class(es) will be invoked automatically. In addition, the <construct> clause of the class(es) will be processed. This execution of the constructors is the normal course of action for object oriented languages. If, however, the value of the construct attribute is false then neither the constructor method nor the <construct> clause will be invoked. This latter option is merely object activation rather than true object instantiation. The purpose for this is to enable an object to be loaded dynamically into a remote Superx++ interpreter without re-executing its construction. Instead, the values that already exist in the object's members remain as they were after activation.
Example #1 <node name="MyNode" />

The <node> statement instantiates an object of class Node whose name is MyNode which contains nothing.

Example #2 <node name="MyNode">Hello World!</node>

The <node> statement instantiates an object of class Node whose name is MyNode which contains the value Hello World!.

Example #3 <node name="MyNode">
   <MyChild status="new" var_int_d="2" arr_string_x.3.="{cat,dog,mouse}">
      Inside
   </MyChild>
</node>

The <node> statement instantiates an object of class Node whose name is MyNode which contains another object. The contained object is called MyChild and contains a value, Inside, an attribute called status whose value is new, a integer variable called d whose value is 2 and a string array with 3 elements called x whose elements' values are cat, dog and mouse respectively.

Example #4 <node name="MyTree" class="XPlant" />

The <node> statement instantiates an object of class XPlant whose name is MyTree which contains only the inherited members and methods of the XPlant class. This is an example of single inheritance.

Example #5 <node name="MyTree" class="XPlant,XLargeObject" />

The <node> statement instantiates an object of classes XPlant and XLargeObject whose name is MyTree which contains only the inherited members and methods of the XPlant and XLargeObject classes. This is an example of multiple inheritance.

Example #6 <node name="MyTree" class="XPlant,XLargeObject">
   <MyChild status="new" var_int_d="2" arr_string_x.3.="{cat,dog,mouse}">
      Inside
   </MyChild>
</node>

The <node> statement instantiates an object of classes XPlant and XLargeObject whose name is MyTree which inherits members and methods from the XPlant and XLargeObject classes. In addition, the MyTree object contains the MyChild object. This example illustrates multiple inheritance and customized instantiation.

Example #7 <node name="MyTree" class="XPlant,XLargeObject" processcode="true">
   <MyChild>
      <getxout />
   </MyChild>
</node>

The <node> statement instantiates an object of classes XPlant and XLargeObject whose name is MyTree which inherits members and methods from the XPlant and XLargeObject classes. In addition, the MyTree object contains the MyChild object which in turn contains the contents of the output stream. This example illustrates multiple inheritance and customized instantiation while showing the utility of the processcode attribute.

Example #8 <node name="MyTree" class="XPlant,XLargeObject" processcode="false">
   <MyChild>
      <getxout />
   </MyChild>
</node>

The <node> statement instantiates an object of classes XPlant and XLargeObject whose name is MyTree which inherits members and methods from the XPlant and XLargeObject classes. In addition, the MyTree object contains the MyChild object which in turn contains the <getxout> statement as a child node. This example illustrates multiple inheritance and customized instantiation while showing the utility of the processcode attribute.

Example #9 <node name="MyTree" class="XPlant" construct="true" />

The <node> statement instantiates an object of class XPlant whose name is MyTree which contains only the inherited members and methods of the XPlant class. The constructor method and the <construct> clauses of the XPlant class are executed.

Example #10 <node name="MyTree" class="XPlant" construct="false" />

The <node> statement instantiates an object of class XPlant whose name is MyTree which contains only the inherited members and methods of the XPlant class. There is no execution of either the constructor method or the <construct> clauses of the XPlant class.