Probing molecular structure and dynamics with coherent extreme ultraviolet and X-ray pulses