Not very much like a mass-spectrometer which creates a characteristic pattern of masses resulting from the test material as it is manipulated by the electron ionization or chemical ionization process. Where ions are detected across the atomic mass range of the particular spectrometer, forming a characteristic pattern or "spectrum" across that range.
Actually more jewelers and gold dealers than ever are using the x-ray guns professionally for bulk assay on an everyday basis. There are some handhelds which may be sensitive enough for trace analysis in food, but that requires a whole nother level of dedication beyond identification of metal objects, not just in technique and training but "laboratory" preparation as well.
The first obstacle would be convincing an owner of an instrument having capable specs, to embrace usage for things other than gold and silver assay. Then seriously pursue mastery of the instrument more so than ever to accomplish decent detection of low levels of lead and other metals like chromium, mercury, cadmium, etc.
[1] https://pubmed.ncbi.nlm.nih.gov/25214856/ ("Contaminated turmeric is a potential source of lead exposure for children in rural Bangladesh" / "Results: Lead concentrations in many turmeric samples were elevated, with lead concentrations as high as 483 ppm")