Yes, 2 foreigners can get married in mainland China as long as you can provide all right documents. You can register your marriage in China's Civil Affairs Bureau, and you may also go to your country's embassy in PRC to get married. Just give it a try.