Note that (assuming you're a Canadian citizen, but this goes for many other nationalities as well) you need a visa to visit PEK (Beijing). You can, however, stay in PVG (Shanghai) for up to 48 hours without a visa, though you must be in transit to somewhere else (and able to prove it with valid travel documents and tickets for the destination).