// iterate over the selection
while ( cursor.toNextSelection() )
{
// two views of the same data:
// move back and forth between XmlObject <-> XmlCursor
Transaction trans = (Transaction) cursor.getObject();
float amount = trans.getAmount();
if (cursor.getName().equals( deposit ))
balance += amount;
else if ((balance -= amount) < 0)
{