Purpose | The attr statement is used to define an XML attribute within the main part of a Superx++ program or within a method. | |||||||
Format |
attr({object name}) {attribute name};
attr({object name}) {attribute name} = {attribute value};
{object name} |
the name of the node/object to which the attribute will be applied |
{attribute name} |
the name of the attribute |
{attribute value} |
(optional) the initial value of the attribute |
|
|
What an Attribute defined in an Object looks like in Run-Time Memory | ||||||||
Let us consider an attribute defined in an object, MyEmployee, called status whose value is current. This attribute will be rendered in the run-time memory as follows: <xppRAM> <MyEmployee status="current" /> </xppRAM> where xppRAM is the memory object. |
||||||||
Example #1 |
attr(MyEmployee) status = "current"; Defines an attribute called status for the MyEmployee object and sets its initial value to current. |
|||||||
Example #2 |
attr(MyEmployee) status = MyCompany.GetStatus(id = MyEmployee.EmployeeID); Defines an attribute status on the MyEmployee object and sets its initial value to the return value of the GetStatus method invoked on the MyCompany object. |