  Procedures based on current methods to detect sources in X-ray images are
applied to simulated XMM images. All significant instrumental effects are taken
into account, and two kinds of sources are considered -- unresolved sources
represented by the telescope PSF and extended ones represented by a b-profile
model. Different sets of test cases with controlled and realistic input
configurations are constructed in order to analyze the influence of confusion
on the source analysis and also to choose the best methods and strategies to
resolve the difficulties.
  In the general case of point-like and extended objects the mixed approach of
multiresolution (wavelet) filtering and subsequent detection by SExtractor
gives the best results. In ideal cases of isolated sources, flux errors are
within 15-20%. The maximum likelihood technique outperforms the others for
point-like sources when the PSF model used in the fit is the same as in the
images. However, the number of spurious detections is quite large.
  The classification using the half-light radius and SExtractor stellarity
index is succesful in more than 98% of the cases. This suggests that average
luminosity clusters of galaxies (L_[2-10] ~ 3x10^{44} erg/s) can be detected at
redshifts greater than 1.5 for moderate exposure times in the energy band below
5 keV, provided that there is no confusion or blending by nearby sources.
  We find also that with the best current available packages, confusion and
completeness problems start to appear at fluxes around 6x10^{-16} erg/s/cm^2 in
[0.5-2] keV band for XMM deep surveys.
