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="{object name}" name="{attribute name}"> {attribute value} <arr>
{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 object="MyEmployee" name="status">current</arr> Defines an attribute called status for the MyEmployee object and sets its initial value to current. |
|||||||
Example #2 |
<attr object="MyEmployee" name="status"> <eval object="MyCompany" member="GetStatus"> <parm type="int" name="id"> <eval object="MyEmployee" member="EmployeeID" /> </parm> </eval> </arr> 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. |