Product of projectors of a observable with continuous spectrum Consider a hermitian quantum mechanical observable $\hat{N}$ with discrete non-degenerate eigenvalues $n_{i}$, and eigenstates $\left | N_{i} \right>$, thus
$$\hat{N}\left | N_{i} \right>=n_{i} \left | N_{i} \right>, \tag{1}$$
where the set $\left\lbrace \left | N_{i} \right> \right\rbrace$ forms a complete and orthonormal set
$$\sum_{i} \left | N_{i} \right> \left< N_{i} \right| = 1, \tag{2}$$
$$\left< N_{i} \right.\left| N_{i'} \right>=\delta_{i i'}, \tag{3}$$
being  $\delta_{i i'}$ the Kronecker delta. With these assumptions is possible to write the observable $\hat{N}$ through their eigenvalues and projectors $\hat{P_{i}}= \left | N_{i} \right> \left< N_{i} \right|$ as
$$\hat{N}=\sum_{i} n_{i} \left | N_{i} \right> \left< N_{i} \right| \tag{4}.$$ 
Thus, is easy to proof $\hat{P}_{i}\hat{P}_{i'}=\left | N_i \right> \left< N_{i'} \right| \delta_{ii'}$:
$$\hat{P}_{i}^{2}= \left | N_{i} \right>\left< N_{i} \right| \left. N_{i'} \right>\left< N_{i'} \right|=\left | N_{i} \right> \left< N_{i'} \right|\delta_{ii'}, \tag{5} $$
Where we have used the orthonormalization condition, Eq. (3), so, is obvious that in the case of $i=i'$
$$\hat{P}_{i}^{2}=\hat{P}_{i}. \tag{6}$$
But now consider that the observable $\hat{N}$ has a continuous spectrum, thus, the label $i$ is a continuous index, therefore, the completeness and orthonormalization conditions, Eqs. (2), (3), are
$$\int di \left | N_{i} \right> \left< N_{i} \right| = 1, \tag{7}$$
$$\left< N_{i} \right.\left| N_{i'} \right>=\delta(i -i'), \tag{8}$$ 
where $\delta(i -i')$ is the Dirac delta. Then, as in the discrete case, is possible to proof that
$$\hat{P}_{i}\hat{P}_{i'}=\left | N_i \right> \left< N_{i'} \right| \delta(i-i'), \tag{9}$$
so, the question is: for the continuous case, how to prove that $\hat{P}_{i}^{2}=\hat{P}_{i}?.$ 
 A: Technically speaking, there is no eigenvector $\lvert N_i\rangle$ for continuous spectrum, so the expression $\int \lvert N_i\rangle\langle N_i\rvert \mathrm{d}i$ does not make sense. There is a notion of generalized eigenvector as a distribution, but apart from extremely simple cases (position or momentum operator) it is not very useful, at least in my opinion.
The useful concept, in the spectral theory of operators with continuous spectrum is that of spectral measures. These measures are projection-valued, rather than scalar valued. In other words, the measure of a subset of the reals is not a number, but an orthogonal projection instead. If we denote by $\mathrm{d}P_N(\lambda)$ the spectral measure of the observable $N$, then
$$\int_{E} \mathrm{d}P_N(\lambda)$$
represents the orthogonal projection on the spectral subspace where the observable takes values in $E\subseteq \sigma(N)\subseteq \mathbb{R}$ (with $\sigma(N)$ here being the spectrum of $N$).
The observable itself can be written in terms of the spectral measure:
$$N=\int_{\sigma(N)}\lambda\, \mathrm{d}P_N(\lambda)\; .$$
Observe also that if $\underline{\lambda}\in \sigma_{\mathrm{ac}}(N)$ is in the continuous spectrum (more precisely, in the so-called absolutely continuous spectrum), then
$$\int_{\{\underline{\lambda}\}} \mathrm{d}P_N(\lambda)=0\; .$$
However, if $\underline{\lambda}\in \sigma_{\mathrm{disc}}(N)$ is in the discrete spectrum, then
$$\int_{\{\underline{\lambda}\}} \mathrm{d}P_N(\lambda)\neq 0$$
is the orthogonal projection on the eigensubspace of $\underline{\lambda}$. In particular, if $\underline{\lambda}$ has multiplicity one, then
$$\int_{\{\underline{\lambda}\}} \mathrm{d}P_N(\lambda)= \lvert \underline{\lambda} \rangle \langle \underline{\lambda} \rvert\; .$$
The fact that to every self-adjoint operator is associated an unique spectral measure with the properties above (as well as other ones) is called spectral theorem. It would be ill-advised to explain and prove the spectral theorem in an answer here, however it is by means of that theorem that one proves the general spectral subspace decomposition of self-adjoint operators.
A: Imagine that the observable you want to measure is eg. position $\hat{x}$.
When you measure it in a real-life experiment, the result will be an interval of certainty – something like $x = x_0 \pm \varepsilon$. You won't be able to project the original state onto one pure eigenvalue $\left| x_0\right>$, but instead you'll project it to a subspace $\left\{ \left| x \right> : x_0 - \varepsilon \leq x \leq x_0 + \varepsilon \right\}$. (See Sakurai, Napolitano, p. 41.)
So the projector corresponding to your measurement is:
$$
\hat{P}_{\left[ x_0 - \varepsilon, x_0 + \varepsilon \right]}
=
\int_{x_0-\varepsilon}^{x_0 + \varepsilon} \mathrm{d}x
\left| x \right> \left< x \right|.
$$
You can easily see that $\hat{P}^2 = \hat{P}$:
$$
\begin{align}
\hat{P}_{\left[ x_0 - \varepsilon, x_0 + \varepsilon \right]}^2
&=
\int_{x_0-\varepsilon}^{x_0 + \varepsilon} \mathrm{d}x
\int_{x_0-\varepsilon}^{x_0 + \varepsilon} \mathrm{d}x'
\left| x \right> \left< x | x' \right> \left< x' \right|
\\[10pt]
&=
\int_{x_0-\varepsilon}^{x_0 + \varepsilon} \mathrm{d}x
\int_{x_0-\varepsilon}^{x_0 + \varepsilon} \mathrm{d}x'
\left| x \right> \delta(x-x') \left< x' \right|
\\[10pt]
&=
\int_{x_0-\varepsilon}^{x_0 + \varepsilon} \mathrm{d}x
\left| x \right> \left< x \right|
= \hat{P}_{\left[ x_0 - \varepsilon, x_0 + \varepsilon \right]}.
\end{align}
$$
We've used the defining property of $\delta$ which says:
$$
\int \mathrm{d}x \; f(x) \; \delta(x-a) = f(a).
$$
You can see that the equality $\hat{P}^2 = \hat{P}$ holds for all $\varepsilon > 0$. If you try to set $\varepsilon = 0$, you'll run into trouble: the interval you integrate over would become a single-point set $\left\{ x_0 \right\}$ whose Lebesgue measure is zero. Your projector would be a null operator $\hat{P} = 0$ from definition.
However, this is fine. If you start with a particle in state
$$
\left| \psi \right> = \int_{-\infty}^{+\infty} \mathrm{d}x \; f(x) \left| x \right>,
$$
where $f$ is a (non-generalised) function, the probability of finding the particle exactly in state $\left| x_0 \right>$ is also zero. And if you run into a situation where the position is a combination of discrete states, you can change back to a discrete basis.
(The case when $f$ is a distribution would require special care.)
