For Yggdrasil frist question, I do not have experience, but basically, fluorescent spectra of various pure elements is easily accessible - just put into Google "XRF spectra of -element-" and in the first pictures, it will give you something like this:
http://www.xrfresearch.com/xrf-spectrum-gold/
Then imagine having 10 elements alltogether, and it starts to look like we use to call "forest of peaks"
or Himalayas
Then factor in the scattering of the matrix, let´s say you do not have metallic sample, but only som light matrix powder... Like grinded cat or our favourite "rhodium ore"
And yay !! You created PGM ore ! Because the poor machine is only that good how we built it.
And callibrated it.
--------------------
Alondro nicely sumed up how it works. Yes, basically, XRF stand for X - Ray Fluorescence. Fluorescence means the light emitted by irradiation with light of another wavelength. Similarly to fluorescent colours, which glow under UV light ("blacklight", for example in the night clubs). This time, the material is irradiated with X-rays, which are very high energy photons, compared to say regular visible light. This cause electrons with same energy levels as the source of radiation to be kicked from their orbitals - and this is accompanied with that fluorescence.
When electron bounces back to lower energy state, it gives off that extra energy away as photon of lower energy - and XRF detects this emitted radiation.
Since every element has different bounding energies for it´s electrons, we can relatively accurately tell, which elements are present, and in what quantities/ratios.
Of course, there is this "scattering" issue with light matrix samples. But this is another chapter
and I think that I am not competent enough in this field to tell you how it really is
Long story short, upon crash with light elements (generally magnesium and lower), good portion of X-rays aren´t absorbed to kick electrons, but as matrix is light, they simply fly through it and are bent. This cause alteration of the original set of wavelengths, and you can already feel where it is going
And yeah, MS is much more accurate in precise determination of not only elements themselves, but even their isotopes.