State machine configurable by XML