switch (result.getType())
{
case XObject.CLASS_BOOLEAN:
return result.bool();
case XObject.CLASS_NUMBER:
return result.num();
case XObject.CLASS_STRING:
return result.str();
case XObject.CLASS_NODESET:
if (_onlyFirstResult)
return result.nodeset().nextNode();