Problem with two way xbee communication

okay.. Got your point..!!
GPS sends data at a rate of 1 Hz i.e. every 1 second it transmits data.
Then how to program my arduino, so that whenever the data from GPS is available, it should transmit it via XBee and for the remaining time it should Listen to the Serial Port.
Can you help me with the programming part?
An example program will be helpful.
Thanks for the replies.