<xpp>
<!--
This file
demonstrates the high degree of flexibility that Superx++ has
with entity
access.
The _object()
syntax allows you to place any expression within the parentheses
as the object
being accessed.
The _member()
syntax allows you to place any expression within the parentheses
as the member
being accessed.
The _method()
syntax allows you to place any expression within the parentheses
as the method
being accessed.
The _attribute()
syntax allows you to place any expression within the parentheses
as the attribute
being accessed.
-->
<!-- define the entities to be
accessed -->
<node processcode="true" construct="true" name="x">
<cats upd="false"
num="0">5</cats>
<dogs>4</dogs>
</node>
<var type="int" name="iVal">777</var>
<!-- change the entities somehow
-->
<eval>
<object>x/cats</object>
<value>
<eval>
<expr>700</expr>
</eval>
</value>
</eval>
<eval>
<object>x/cats</object>
<attribute>upd</attribute>
<value>
<eval>
<expr>"true"</expr>
</eval>
</value>
</eval>
<!-- write stuff to the output stream
from the entities -->
<xout processcode="true">
<eval>
<parm type="string" name="Parm0">
<eval>
<object>mem/x/cats</object>
<method>
<name>value</name>
</method>
</eval>
</parm>
<expr>"\r\n$mem/x/cats.value()
= " + Parm0 + "..."</expr>
</eval>
</xout>
<xout processcode="true">
<eval>
<parm type="string" name="Parm0">
<eval>
<object>mem/x/cats</object>
<attribute>upd</attribute>
</eval>
</parm>
<expr>"\r\n$mem/x/cats.upd
= " + Parm0 + "..."</expr>
</eval>
</xout>
<xout processcode="true">
<eval>
<parm type="string" name="Parm0">
<eval>
<object>mem/x/cats</object>
<attribute>num</attribute>
</eval>
</parm>
<expr>"\r\n$mem/x/cats.num
= " + Parm0 + "..."</expr>
</eval>
</xout>
<eval>
<object>x/cats</object>
<attribute>num</attribute>
<value>
<eval>
<parm type="string" name="Parm0">
<eval>
<object>x/cats</object>
<attribute>num</attribute>
</eval>
</parm>
<expr>Parm0 + 1</expr>
</eval>
</value>
</eval>
<xout processcode="true">
<eval>
<parm type="string" name="Parm0">
<eval>
<object>mem/x/cats</object>
<attribute>num</attribute>
</eval>
</parm>
<expr>"\r\n$mem/x/cats.num
= " + Parm0 + "..."</expr>
</eval>
</xout>
<!-- add 1 to the iVal -->
<eval>
<object>iVal</object>
<value>
<eval>
<parm type="int" name="Parm0">
<eval>
<object>iVal</object>
</eval>
</parm>
<expr>Parm0 + 1</expr>
</eval>
</value>
</eval>
<!-- sObj1 will contain the first half
of the name of the entity
while sObj2 will contain the second half of the name -->
<var type="string" name="sObj1">iV</var>
<var type="string" name="sObj2">al</var>
<!-- access the entity now -->
<xout processcode="true">
<eval>
<parm type="string" name="Parm0">
<eval>
<object>
<eval>
<parm type="string" name="Parm0">
<eval object="sObj1"/>
</parm>
<parm type="string" name="Parm1">
<eval object="sObj2"/>
</parm>
<expr>Parm0 + Parm1</expr>
</eval>
</object>
</eval>
</parm>
<expr>"\r\niVal =
" + Parm0</expr>
</eval>
</xout>
</xpp>