Here is a great little educational video on an XRF Working Principle.