I agree with most of what is posted at Rocky Mountain Labs, but I would say it a bit differently. There are two main areas of difference between the techniques: the excitation and the detectors.
SEM-microanalysis uses the energetic electrons of the beam of the SEM to knock out inner shell electrons from atoms in the sample. As the sample relaxes, i.e., outer shell electrons fall into the vacancies, they can result in the emission of an x-ray photon. Since a focused beam is exciting the sample, it can be used to analyze small volumes (a few um). Since electrons are interacting with the sample, there is also a lot of bremstrallung background.
XRF uses a beam of x-rays to excite the sample. Those x-rays could come from a tube or from a radioactive source. They knock out the same inner shell electrons and x-rays are produced the same way as in the SEM. However, XRF leads to a much lower background. Since detection depends on peak to background ratio, detection is much better. The XRF source is typically much more intense so count rate and detection improve. The down side is that the excitation volume is much larger. Typically the area was several mm across. New systems can reduce that to tens of um, but it is not microscopic.
Detection is a different issue. Both SEM and XRF systems can use either energy-dispersive spectroscopy (based on a Si chip) or wavelength dispersive spectroscopy (based on diffracting crystals) to analyze the x-rays. EDS tends to be cheaper than WDS. It is better suited to weaker signals (as from an SEM), but it has less energy resolution than WDS.