this is the one that i got for my x20xev and they look the same on the c20xe. but i couldnt tell you regarding the x20xe as i dont know much about these engines. from looking at the table provided on the link they dont seam to fit the x20xe, are you sure thats your engine code? is it not an x20xev or c20xe?
If you've got a C20XE 'redtop' engine then the crank sensor from a later Ecotec wont fit. The C20XE's are the earlier Bosch stuff. If the EML isn't on its very unlikely to be a sensor fault and unlikely any codes are stored. If the crank sensor is iffy the engine wont run at all. The early C20XE (with the dizzy) doesnt have a cam sensor as such, it uses a hall sender in the dizzy for the cylinder recorgnision signal. To me your problem sounds more like a dodgy air flow meter or an air leak somewhere. Is the engine revving high on idle at all?