Node

Purpose The Node abstract class is the root class for all classes and objects in Superx++. This supports one of the aims of Superx++ which is to be tightly coupled with XML. Thus, every object in Superx++ is a node and can therefore be rendered perfectly as an XML fragment. Entire Superx++ programs as well can be rendered as XML documents. And of course they are all parseable by any XML parser. This is because Superx++ itself is based on and complies with the XML version 1.0 specification published by the W3C.
Format The Node class is not actually referred to directly in the Superx++ syntax. It is implemented internally however in the run-time engine. Therefore the methods that it implements are automatically inherited and available to all classes and objects. The Node class does not implement any member variables or arrays and has no attributes.

The Methods of the Node Abstract Class
append
adds an object to become the new last child node of an object
<eval object="{source object name}" member="append">
   <parm type="string">{name of object to be appended}</parm>
</eval>

where:
{source object name} is the name of the object into which the other object will be appended
{name of object to be appended} is the name of the object to be appended as the last child node of the object

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
</node>
<node name="MyCourse">Superx++ Intro Course</node>
<eval object="MyStudent" member="append">
   <parm type="string">MyCourse</parm>
</eval>

This code results in the MyStudent node being of the following form:
<MyStudent class="">
   <Name>Johnnie B. Goode</Name>
   <MyCourse>Superx++ Intro Course</MyCourse>
</MyStudent>

cdata
returns the CDATA sections of an object
<eval object="{source object name}" member="cdata" />

where:
{source object name} is the name of the object which contains the CDATA sections

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <![CDATA[ my 1st... ]]>
   <![CDATA[ my 2nd... ]]>
   <Phone>1-800-BAD-MUSC</Phone>
   <![CDATA[ my 3rd... ]]>
   <Address>2400 MyStreet, Anytown</Address>
   <![CDATA[ my 4th... ]]>
   <![CDATA[ my 5th... ]]>
</node>
<xout>CDATA for Phone is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="cdata" />
</xout>
<xout>\r\nCDATA for Address is\r\n</xout>
<xout>
   <eval object="MyStudent/Address" member="cdata" />
</xout>

This code results in the following text being written to the output stream on separate lines:
CDATA for Phone is
![CDATA[ my 1st... ]]
![CDATA[ my 2nd... ]]
CDATA for Address is
![CDATA[ my 3rd... ]]
![CDATA[ my 4th... ]]
![CDATA[ my 5th... ]]

The default for CDATA section parsing by the Superx++ run-time engine is that the CDATA sections that precede a node will belong to that node. The exception occurs for the last node in a level of the tree, in which case it gets the CDATA sections before and after it. The same applies to comments.

child
returns the specified child node of an object
<eval object="{parent object name}" member="node">
   <parm type="string">{name of child}</parm>
</eval>

where:
{parent object name} is the name of the parent object
{name of child} is the name of the child object of the parent object

<eval object="{parent object name}" member="node">
   <parm type="string">{sibling number of child}</parm>
</eval>

where:
{parent object name} is the name of the parent object
{sibling number of child} is the sibling number of the child object of the parent object

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>The child is\r\n</xout>
<xout>
   <eval object="MyStudent" member="child">
      <parm type="string">Phone</parm>
   </eval>
</xout>

This code results in the following text being sent to the output stream:
The child is
1-800-BAD-MUSC

If we change the <eval> statement nested within the <xout> statement to the following:
<xout>
   <eval object="MyStudent" member="child" includepath="true">
      <parm type="string">Phone</parm>
   </eval>
</xout>

then the text sent to the output stream will be:
The child is
<Phone>1-800-BAD-MUSC</Phone>

The reason for this is that the <eval> statement will use the includepath attribute default of false to execute. In that case any node trees with only one terminal node will return just the value of the terminal node. To get the actual node tree you will need to set includepath to true.

You can also use the sibling number to get the child object as shown below:

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>The child is\r\n</xout>
<xout>
   <eval object="MyStudent" member="child">
      <parm type="int">1</parm>
   </eval>
</xout>

This code results in the following text being sent to the output stream:
The child is
1-800-BAD-MUSC

comments
returns the comments of an object
<eval object="{source object name}" member="comments" />

where:
{source object name} is the name of the object which contains the comments

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <!-- my 1st... -->
   <!-- my 2nd... -->
   <Phone>1-800-BAD-MUSC</Phone>
   <!-- my 3rd... -->
   <Address>2400 MyStreet, Anytown</Address>
   <!-- my 4th... -->
   <!-- my 5th... -->
</node>
<xout>comments for Phone is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="comments" />
</xout>
<xout>\r\ncomments for Address is\r\n</xout>
<xout>
   <eval object="MyStudent/Address" member="comments" />
</xout>

This code results in the following text being written to the output stream on separate lines:
comments for Phone is
<!-- my 1st... -->
<!-- my 2nd... -->
comments for Address is
<!-- my 3rd... -->
<!-- my 4th... -->
<!-- my 5th... -->

The default for comments section parsing by the Superx++ run-time engine is that the comments that precede a node will belong to that node. The exception occurs for the last node in a level of the tree, in which case it gets the comments before and after it. The same applies to CDATA sections.

constructor
the constructor method does nothing by default-- over-ride it in your class to perform resource allocation and other necessary initialization activities before instantiation of an object is complete
The constructor method is not typically called directly by the programmer. Rather it is automatically invoked when an object is instantiated. The default constructor method takes no parameters. You can however, overload the constructor method in your classes by implementing multiple constructor methods with varying number of parameters.

<class name="XPerson" inherit="">
   <construct>
      <scope type="public">
         <Name>Johnnie B. Goode</Name>
         <Phone>1-800-BAD-MUSC</Phone>
         <Address>2400 MyStreet, Anytown</Address>
      </scope>
   </construct>
   <scope type="public">
      <func name="constructor" type="void">
         <body>
            <xout>\r\nIn the constructor for </xout>
            <xout><eval object="this" member="tag" /></xout>
         </body>
      </func>
      <func name="constructor" type="void">
         <parm type="string" name="parm1" />
         <body>
            <xout>\r\nIn the constructor: parm1 = </xout>
            <xout><eval object="parm1" /></xout>
            <xout> for </xout>
            <xout><eval object="this" member="tag" /></xout>
         </body>
      </func>
   </scope>
</class>
<node name="MyStudent" class="XPerson">
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</node>
<node name="MyPal" class="XPerson">
   <parm type="string" name="parm1">100</parm>
</node>
<xout>\r\nMemory is\r\n</xout>
<xout>
   <eval object="mem" includepath="true" />
</xout>

This code results in the following text being written to the output stream:

In the constructor for MyStudent
In the constructor: parm1 = 100 for MyPal
Memory is
<xppRAM>
   <MyStudent class="XPerson">
      <Name>Johnnie B. Goode</Name>
      <Phone>1-800-BAD-MUSC</Phone>
      <Address>2400 MyStreet, Anytown</Address>
      <Schools>
         <university>Cambridge</university>
         <high>Kingston</high>
      </Schools>
   </MyStudent>
   <MyPal class="XPerson">
      <Name>Johnnie B. Goode</Name>
      <Phone>1-800-BAD-MUSC</Phone>
      <Address>2400 MyStreet, Anytown</Address>
   </MyPal>
</xppRAM>

The example above illustrates overloading of the constructor method in the XPerson class. It also illustrates customized instantiation in the case of the MyStudent object. Notice how the Schools child object does not exist in XPerson but exists in the instantiated MyStudent object. This shows an individual mutation in MyStudent that does not exist in the class it belongs to. Also, notice how the parameter for the constructor method is passed using the <node> statement for MyPal. This <parm> node is consumed by the constructor method and does not appear in the instantiated MyPal object. <parm> is a special node in the <node> statement and is used for the constructor methods-- it never appears in the instantiated object produced by the <node> statement.

copy
copies an object's value, descendants, attributes and members to another object
<eval object="{source object name}" member="copy">
   <parm type="string">{name of object to be copied}</parm>
</eval>

where:
{source object name} is the name of the object into which the other object will be copied
{name of object to be copied} is the name of the object to be copied

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
</node>
<node name="MyCourse">Superx++ Intro Course</node>
<eval object="MyStudent" member="copy">
   <parm type="string">MyCourse</parm>
</eval>

This code results in the MyStudent node being of the following form:
<MyStudent class="">
   <MyCourse>Superx++ Intro Course</MyCourse>
</MyStudent>

count/numchildren
returns the number of children of an object
<eval object="{source object name}" member="count" />

<eval object="{source object name}" member="numchildren" />

where:
{source object name} is the name of the parent object

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent has </xout>
<xout>
   <eval object="MyStudent" member="count" />
</xout>
<xout> children</xout>

This code results in the following text being written to the output stream:
MyStudent has 3 children

delete
deletes an object and all its descendants
<eval object="{object name}" member="delete" />

where:
{object name} is the name of the object to be deleted

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</node>
<eval object="MyStudent/Schools" member="delete" />
<xout>MyStudent is\r\n</xout>
<xout>
   <eval object="MyStudent" />
</xout>

This code results in the following text being written to the output stream:
MyStudent is
<MyStudent class="">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</MyStudent>

deletechild
deletes a specific child object of an object
<eval object="{object name}" member="deletechild">
   parm type="string">{child name}</parm>
</eval>

where:
{object name} is the name of the object whose child is to be deleted
{child name} is the name of the child object to be deleted

<eval object="{object name}" member="deletechild">
   parm type="int">{child sibling number}</parm>
</eval>

where:
{object name} is the name of the object whose child is to be deleted
{child sibling number} is the sibling number of the child object to be deleted

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</node>
<eval object="MyStudent" member="deletechild">
   <parm type="int">3</parm>
</eval>
<xout>MyStudent is\r\n</xout>
<xout>
   <eval object="MyStudent" />
</xout>

This code results in the following text being written to the output stream:
MyStudent is
<MyStudent class="">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</MyStudent>

deletechildren
deletes an object's descendant nodes
<eval object="{object name}" member="deletechildren" />

where:
{object name} is the name of the object whose descendants are to be deleted

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</node>
<eval object="MyStudent/Schools" member="deletechildren" />
<xout>MyStudent is\r\n</xout>
<xout>
   <eval object="MyStudent" />
</xout>

This code results in the following text being written to the output stream:
MyStudent is
<MyStudent class="">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
   <Schools></Schools>
</MyStudent>

deletechildrenexcept
deletes all the descendants of an object except a specific child and its descendants
<eval object="{object name}" member="deletechildrenexcept">
   parm type="string">{child name}</parm>
</eval>

where:
{object name} is the name of the object whose descendants are to be deleted
{child name} is the name of the child object to be preserved

<eval object="{object name}" member="deletechildrenexcept">
   parm type="int">{child sibling number}</parm>
</eval>

where:
{object name} is the sibling number of the object whose descendants are to be deleted
{child sibling number} is the sibling number of the child object to be preserved

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</node>
<eval object="MyStudent" member="deletechildrenexcept">
   <parm type="int">3</parm>
</eval>
<xout>MyStudent is\r\n</xout>
<xout>
   <eval object="MyStudent" />
</xout>

This code results in the following text being written to the output stream:
MyStudent is
<MyStudent class="">
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</MyStudent>

deleteleavechildren
deletes an object and inserts its children in its stead as children of its parent object
<eval object="{object name}" member="deleteleavechildren" />

where:
{object name} is the name of the object to be deleted

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<eval object="MyStudent/Schools" member="deleteleavechildren" />
<xout>MyStudent is\r\n</xout>
<xout>
   <eval object="MyStudent" />
</xout>

This code results in the following text being written to the output stream:
MyStudent is
<MyStudent class="">
   <Name>Johnnie B. Goode</Name>
   <university>Cambridge</university>
   <high>Kingston</high>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</MyStudent>

destructor
the destructor method does nothing by default-- over-ride it in your class to perform resource deallocation and other necessary activities before deletion of an object is complete
The destructor method is not typically called directly by the programmer. Rather it is automatically invoked when an object is deleted. The destructor method takes no parameters.

<class name="XPerson" inherit="">
   <construct>
      <scope type="public">
         <Name>Johnnie B. Goode</Name>
         <Phone>1-800-BAD-MUSC</Phone>
         <Address>2400 MyStreet, Anytown</Address>
      </scope>
   </construct>
   <scope type="public">
      <func name="destructor" type="void">
         <body>
            <xout>\r\nIn the destructor</xout>
         </body>
      </func>
   </scope>
</class>
<node name="MyStudent" class="XPerson">
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</node>
<xout>Memory is\r\n</xout>
<xout>
   <eval object="mem" includepath="true" />
</xout>
<eval object="MyStudent" member="delete" />
<xout>\r\nMemory after delete is\r\n</xout>
<xout>
   <eval object="mem" includepath="true" />
</xout>

This code results in the following text being written to the output stream:
Memory is
<xppRAM>
   <MyStudent class="">
      <Schools>
         <university>Cambridge</university>
         <high>Kingston</high>
      </Schools>
      <Name>Johnnie B. Goode</Name>
      <Phone>1-800-BAD-MUSC</Phone>
      <Address>2400 MyStreet, Anytown</Address>
   </MyStudent>
</xppRAM>
Memory is
<xppRAM></xppRAM>

empty
deletes all descendants of an object as well its value, attributes and members
<eval object="{source object name}" member="empty" />

where:
{source object name} is the name of the object to be emptied

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<eval object="MyStudent" member="empty" />
<xout>MyStudent is\r\n</xout>
<xout>
   <eval object="MyStudent" />
</xout>

This code results in the following text being written to the output stream:
MyStudent is
<MyStudent class=""></MyStudent>

firstsibling
returns the first child of the parent of an object-- i.e. the child whose sibling number = 0
<eval object="{source object name}" member="firstsibling" />

where:
{source object name} is the name of the object whose sibling you want to find

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent's first child is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="firstsibling" includepath="true" />
</xout>

This code results in the following text being written to the output stream:
MyStudent's first child is
<Name>Johnnie B. Goode</Name>

insert
inserts an object to become a new child node of an object at an specified position
<eval object="{source object name}" member="insert">
   <parm type="string">{name of object to be shifted}</parm>
   <parm type="string">{name of object to be inserted}</parm>
</eval>

where:
{source object name} is the name of the object into which the other object will be inserted as the child node whose sibling position will be that formerly held by the object referred to by {name of object to be shifted}
{name of object to be shifted} is the name of the object in whose place the object will be inserted-- this object and all subsequent child nodes of the parent object are moved down one position (i.e. their sibling number increases by 1)
{name of object to be inserted} is the name of the object to be inserted into the position formerly held by the object refered to by {name of object to be shifted}

<eval object="{source object name}" member="insert">
   <parm type="int">{sibling number of object to be shifted}</parm>
   <parm type="string">{name of object to be inserted}</parm>
</eval>

where:
{source object name} is the name of the object into which the other object will be inserted as the child node whose sibling position will be that formerly held by the object referred to by {sibling number of object to be shifted}
{sibling number of object to be shifted} is the name of the object in whose place the object will be inserted-- this object and all subsequent child nodes of the parent object are moved down one position (i.e. their sibling number increases by 1)
{name of object to be inserted} is the name of the object to be inserted into the position formerly held by the object refered to by {sibling number of object to be shifted}

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<node name="MyCourse">Superx++ Intro Course</node>
<eval object="MyStudent" member="insert">
   <parm type="string">Phone</parm>
   <parm type="string">MyCourse</parm>
</eval>

This code results in the MyStudent node being of the following form:
<MyStudent class="">
   <Name>Johnnie B. Goode</Name>
   <MyCourse>Superx++ Intro Course</MyCourse>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</MyStudent>

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<node name="MyCourse">Superx++ Intro Course</node>
<eval object="MyStudent" member="insert">
   <parm type="int">1</parm>
   <parm type="string">MyCourse</parm>
</eval>

This code results in the MyStudent node being of the following form:
<MyStudent class="">
   <Name>Johnnie B. Goode</Name>
   <MyCourse>Superx++ Intro Course</MyCourse>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</MyStudent>

isempty
returns true if an object has no value and no descendant nodes
<eval object="{source object name}" member="isempty" />

where:
{source object name} is the name of the object you want to query whether or not it is empty

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent's isempty status is </xout>
<xout>
   <eval object="MyStudent" member="isempty" />
</xout>
<eval object="MyStudent" member="empty" />
<xout>MyStudent's isempty status is </xout>
<xout>
   <eval object="MyStudent" member="isempty" />
</xout>

This code results in the following text being written to the output stream:
MyStudent's isempty status is false
MyStudent's isempty status is true

lastsibling
returns the last child of the parent of an object-- i.e. the child with the highest sibling number
<eval object="{source object name}" member="lastsibling" />

where:
{source object name} is the name of the object whose sibling you want to find

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent's last child is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="lastsibling" includepath="true" />
</xout>

This code results in the following text being written to the output stream:
MyStudent's last child is
<Address>2400 MyStreet, Anytown</Address>

nextsibling
returns the next child of the parent of an object-- i.e. the child with the sibling number 1 higher than that of the object
<eval object="{source object name}" member="nextsibling" />

where:
{source object name} is the name of the object whose sibling you want to find

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent/Phone's next child is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="nextsibling" includepath="true" />
</xout>

This code results in the following text being written to the output stream:
MyStudent/Phone's next child is
<Address>2400 MyStreet, Anytown</Address>

parent
returns the parent containing object of an object
<eval object="{child object name}" member="parent" />

where:
{child object name} is the name of the child object whose parent you want to find

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</node>
<xout>MyStudent/Schools/university's parent is\r\n</xout>
<xout>
   <eval object="MyStudent/Schools/university" member="parent" includepath="true" />
</xout>

This code results in the following text being written to the output stream:
MyStudent/Schools/university's parent is
<Schools>
   <university>Cambridge</university>
   <high>Kingston</high>
</Schools>

path
returns the path of an object
<eval object="{object name}" member="path" />

where:
{object name} is the name of the object whose path you want to find

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</node>
<xout>MyStudent/Schools/university's path is\r\n</xout>
<xout>
   <eval object="MyStudent/Schools/university" member="path" includepath="true" />
</xout>

This code results in the following text being written to the output stream:
MyStudent/Schools/university's path is
//xppRAM/MyStudent/Schools(3)/university

postcdata
returns the succeeding CDATA sections of an object-- put another way, the post-CDATA sections of an object
<eval object="{source object name}" member="postcdata" />

where:
{source object name} is the name of the object which contains the post-CDATA sections

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <![CDATA[ my 1st... ]]>
   <![CDATA[ my 2nd... ]]>
   <Phone>1-800-BAD-MUSC</Phone>
   <![CDATA[ my 3rd... ]]>
   <Address>2400 MyStreet, Anytown</Address>
   <![CDATA[ my 4th... ]]>
   <![CDATA[ my 5th... ]]>
</node>
<xout>post-CDATA for Phone is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="postcdata" />
</xout>
<xout>\r\npost-CDATA for Address is\r\n</xout>
<xout>
   <eval object="MyStudent/Address" member="postcdata" />
</xout>

This code results in the following text being written to the output stream on separate lines:
post-CDATA for Phone is
post-CDATA for Address is
<![CDATA[ my 4th... ]]>
<![CDATA[ my 5th... ]]>

The default for CDATA section parsing by the Superx++ run-time engine is that the CDATA sections that precede a node will belong to that node. The exception occurs for the last node in a level of the tree, in which case it gets the CDATA sections before and after it. The same applies to comments.

postcomments
returns the succeeding comments of an object-- put another way, the post-comments of an object
<eval object="{source object name}" member="postcomments" />

where:
{source object name} is the name of the object which contains the post-comments

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <!-- my 1st... -->
   <!-- my 2nd... -->
   <Phone>1-800-BAD-MUSC</Phone>
   <!-- my 3rd... -->
   <Address>2400 MyStreet, Anytown</Address>
   <!-- my 4th... -->
   <!-- my 5th... -->
</node>
<xout>post-comments for Phone is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="postcomments" />
</xout>
<xout>\r\npost-comments for Address is\r\n</xout>
<xout>
   <eval object="MyStudent/Address" member="postcomments" />
</xout>

This code results in the following text being written to the output stream on separate lines:
post-comments for Phone is
post-comments for Address is
<!-- my 4th... -->
<!-- my 5th... -->

The default for comments parsing by the Superx++ run-time engine is that the comments that precede a node will belong to that node. The exception occurs for the last node in a level of the tree, in which case it gets the comments before and after it. The same applies to CDATA sections.

precdata
returns the preceding CDATA sections of an object-- put another way, the pre-CDATA sections of an object
<eval object="{source object name}" member="precdata" />

where:
{source object name} is the name of the object which contains the pre-CDATA sections

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <![CDATA[ my 1st... ]]>
   <![CDATA[ my 2nd... ]]>
   <Phone>1-800-BAD-MUSC</Phone>
   <![CDATA[ my 3rd... ]]>
   <Address>2400 MyStreet, Anytown</Address>
   <![CDATA[ my 4th... ]]>
   <![CDATA[ my 5th... ]]>
</node>
<xout>pre-CDATA for Phone is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="precdata" />
</xout>
<xout>\r\npre-CDATA for Address is\r\n</xout>
<xout>
   <eval object="MyStudent/Address" member="precdata" />
</xout>

This code results in the following text being written to the output stream on separate lines:
pre-CDATA for Phone is
<![CDATA[ my 1st... ]]>
<![CDATA[ my 2nd... ]]>
pre-CDATA for Address is
<![CDATA[ my 3rd... ]]>

The default for CDATA section parsing by the Superx++ run-time engine is that the CDATA sections that precede a node will belong to that node. The exception occurs for the last node in a level of the tree, in which case it gets the CDATA sections before and after it. The same applies to comments.

precomments
returns the preceding comments of an object-- put another way, the pre-comments of an object
<eval object="{source object name}" member="precomments" />

where:
{source object name} is the name of the object which contains the pre-comments

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <!-- my 1st... -->
   <!-- my 2nd... -->
   <Phone>1-800-BAD-MUSC</Phone>
   <!-- my 3rd... -->
   <Address>2400 MyStreet, Anytown</Address>
   <!-- my 4th... -->
   <!-- my 5th... -->
</node>
<xout>pre-comments for Phone is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="precomments" />
</xout>
<xout>\r\npre-comments for Address is\r\n</xout>
<xout>
   <eval object="MyStudent/Address" member="precomments" />
</xout>

This code results in the following text being written to the output stream on separate lines:
pre-comments for Phone is
<!-- my 1st... -->
<!-- my 2nd... -->
pre-comments for Address is
<!-- my 3rd... -->

The default for comments parsing by the Superx++ run-time engine is that the comments that precede a node will belong to that node. The exception occurs for the last node in a level of the tree, in which case it gets the comments before and after it. The same applies to CDATA sections.

prepend
adds an object to become the new first child node of an object
<eval object="{source object name}" member="prepend">
   <parm type="string">{name of object to be prepended}</parm>
</eval>

where:
{source object name} is the name of the object into which the other object will be added as the first child node
{name of object to be prepended} is the name of the object to be added as the first child node of the object

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
</node>
<node name="MyCourse">Superx++ Intro Course</node>
<eval object="MyStudent" member="prepend">
   <parm type="string">MyCourse</parm>
</eval>

This code results in the MyStudent node being of the following form:
<MyStudent class="">
   <MyCourse>Superx++ Intro Course</MyCourse>
   <Name>Johnnie B. Goode</Name>
</MyStudent>

prevsibling/priorsibling
returns the previous child of the parent of an object-- i.e. the child with the sibling number 1 lower than that of the object
<eval object="{source object name}" member="prevsibling" />

<eval object="{source object name}" member="priorsibling" />

where:
{source object name} is the name of the object whose sibling you want to find

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent/Phone's prev child is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="prevsibling" includepath="true" />
</xout>

This code results in the following text being written to the output stream:
MyStudent/Phone's prev child is
<Name>Johnnie B. Goode</Name>

root
returns the root container object of an object
<eval object="{source object name}" member="root" />

where:
{source object name} is the name of the object whose root you want to find

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent/Phone's root is\r\n</xout>
<xout>
   <eval object="MyStudent/Phone" member="root" includepath="true" />
</xout>

This code results in the following text being written to the output stream:
MyStudent/Phone's root is
<MyStudent class="">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</MyStudent>

save
serializes an object as XML and saves it to a file-- similar to the <save> statement
<eval object="{source object name}" member="save">
   <parm type="string">{file path}</parm>
</eval

where:
{source object name} is the name of the object you want to save
{file path} is the path to the file to you will save the object

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent's save status is </xout>
<xout>
   <eval object="MyStudent" member="save">
         C:\\MyDir\\MyFile.xml
   </eval>
</xout>

If the save operation succeeded then the following text being written to the output stream:
MyStudent's save status is true
In addition, the file C:\\MyDir\\MyFile.xml would contain the following XML data:
<MyStudent class="">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</MyStudent>

If on the otherhand the save operation failed, the returned value of the save method would have been false

sibling
returns the specified sibling of an object
<eval object="{object name}" member="sibling">
   <parm type="int">{sibling number}</parm>
</eval>

where:
{object name} is the name of the object whose sibling you want to find
{sibling number} is the sibling number of the sibling you want to find

<eval object="{object name}" member="sibling">
   <parm type="string">{sibling name}</parm>
</eval>

where:
{object name} is the name of the object whose sibling you want to find
{sibling name} is the name of the sibling you want to find

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</node>
<xout>MyStudent/Schools' 1st sibling is\r\n</xout>
<xout>
   <eval object="MyStudent/Schools" member="sibling" includesibling="true">
      <parm type="int">0</parm>
   </eval>
</xout>

This code results in the following text being written to the output stream:
MyStudent/Schools' 1st sibling is
<Name>Johnnie B. Goode</Name>

siblingnumber
returns the sibling number of an object
<eval object="{object name}" member="siblingnumber" />

where:
{object name} is the name of the object whose sibling number you want to find

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent/Phone's sibling number is</xout>
<xout>
   <eval object="MyStudent/Phone" member="siblingnumber" />
</xout>

This code results in the following text being written to the output stream:
MyStudent/Phone's sibling number is 1

tag
returns the tag/name of an object
<eval object="{source object name}" member="tag" />

where:
{source object name} is the name of the object whose tag you want

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent/Phone's tag is </xout>
<xout>
   <eval object="MyStudent/Phone" member="tag" />
</xout>

This code results in the following text being written to the output stream:
MyStudent/Phone's tag is Phone

treestructuresame
compares the object trees of two objects using specific criteria for sameness
<eval object="{object name}" member="treestructuresame">
   parm type="string">{compare object name}</parm>
   parm type="string">{criteria}</parm>
</eval>

where:
{object name} is the name of the object doing the comparison
{compare object name} is the name of the object being compared for sameness
{criteria} is the comma-separated criteria list to be used in the comparison


The criteria for treestructuresame comparisons
The number of children at each level of the object trees must be the same in all cases
node compares the tags/names of the two objects and the tags/names of all their descendants-- returns true if they are the same
var compares the names of the member variables of the two objects and the names of the member variables of all their descendants-- returns true if they are the same
arr compares the names of the member arrays of the two objects and the names of the member arrays of all their descendants-- returns true if they are the same
attr compares the names of the attributes of the two objects and the names of the attributes of all their descendants-- returns true if they are the same
value compares the values of the two objects and the values of all their descendants-- returns true if they are the same
<node name="MyStudent">
   <Name var_bool_full="true">Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
   <Schools>
      <university>Cambridge</university>
      <high>Kingston</high>
   </Schools>
</node>
<node name="MyEmployee">
   <Name var_bool_full="false">Kioko Mulwa</Name>
   <Job>Engineer</Job>
   <Company>TeK Systems</Company>
   <Projects>
      <App>HR System 1.9</App>
      <Documentation>none</Documentation>
   </Projects>
</node>
<xout>Nodes same? </xout>
<xout>
   <eval object="MyStudent" member="treestructuresame">
      <parm type="string">MyEmployee</parm>
      <parm type="string">node</parm>
   </eval>
</xout>
<xout>\r\nVariables same? </xout>
<xout>
   <eval object="MyStudent" member="treestructuresame">
      <parm type="string">MyEmployee</parm>
      <parm type="string">var</parm>
   </eval>
</xout>
<node name="MyClone" />
<eval object="MyClone" member="copy">
   <parm type="string">MyStudent</parm>
</eval>
<xout>\r\nMyStudent same as MyClone? </xout>
<xout>
   <eval object="MyStudent" member="treestructuresame">
      <parm type="string">MyClone</parm>
      <parm type="string">node,var,arr,attr,value</parm>
   </eval>
</xout>
<xout>\r\nMyStudent/Schools same as MyClone/Schools? </xout>
<xout>
   <eval object="MyStudent/Schools" member="treestructuresame">
      <parm type="string">MyClone/Schools</parm>
      <parm type="string">node,var,arr,attr,value</parm>
   </eval>
</xout>

This code results in the following text being written to the output stream:
Nodes same? false
Variables same? true
MyStudent same as MyClone? false
MyStudent/Schools same as MyClone/Schools? true

value
returns the value of an object
<eval object="{object name}" member="value" />

where:
{object name} is the name of the object whose value you want

<node name="MyStudent">
   <Name>Johnnie B. Goode</Name>
   <Phone>1-800-BAD-MUSC</Phone>
   <Address>2400 MyStreet, Anytown</Address>
</node>
<xout>MyStudent/Phone's value is </xout>
<xout>
   <eval object="MyStudent/Phone" member="value" />
</xout>
<xout>\r\nMyStudent's value is\r\n</xout>
<xout>
   <eval object="MyStudent" member="value" />
</xout>

This code results in the following text being written to the output stream:
MyStudent/Phone's value is 1-800-BAD-MUSC
MyStudent's value is
<Name>Johnnie B. Goode</Name>
<Phone>1-800-BAD-MUSC</Phone>
<Address>2400 MyStreet, Anytown</Address>