Arduino code for XBee
You probably want to take a look at Robert Faludi's book Building Wireless Sensor Networks, published by O'Reilly. He describes, step by step, a very similar project, but without the Arduino. 

Or Alasdair Allan's Distributed Network Data, also published by O'Reilly, which has a similar project using an Arduino. 

Also, take a look at Robert Faludi's blog TMP36 Instructions: Simple Sensor Network.