xpp {
/* Define the XFeline class */
class XFeline {
public:
int pi;
};
/* Instantiate the MyNode object as an
instance of the abstract class Node */
/* Note that MyNode contains Animals,
which in turn contains cats and dogs */
node MyNode
{
<Animals>
<cats
age="old" class="XFeline" construct="false"
var_int_pi="3.14">5</cats>
<dogs>4</dogs>
</Animals>
};
/* Set the value of cats to be the value
of dogs */
$MyNode/Animals/cats =
$MyNode/Animals/dogs;
/* Write the age attribute of cats */
xout("\r\nage = " +
$MyNode/Animals/cats.age);
/* Write the pi member of cats */
xout("\r\npi = " +
$MyNode/Animals/cats.pi);
}