Yes I have seen the explanation of why this is so in quantum mechanical textbooks. However, let's use the identity operator and do the following:
$$\langle x|x'\rangle =\langle x|I|x'\rangle =\int\langle x|x''\rangle\langle x''|x\rangle dx''=\int\delta(x-x'')*\delta(x''-x)dx'\tag{1}$$
(the integral is from $-\infty$ to $+\infty$. Now, let's look at what we have inside the integral. Clearly, the term inside
$$\delta(x-x'')*\delta(x''-x)\tag{2}$$
is nonzero only if $x''=x'=x$. We can restate this as follows:
$$\delta(x-x'')*\delta(x''-x)=0\text{, if } x\neq x'\tag{3}$$
and
$$\delta(x'-x'')*\delta(x''-x)=\infty \text{ (for certain $x''$ in the region from $-\infty$ to $+\infty$)}\tag{4}$$
if $x=x'$; this means that
$$\delta(x-x'')*\delta(x''-x)=\delta(x'-x).\tag{5}$$
However, if we put $\delta(x'-x)$ instead of $\delta(x-x'')*\delta(x''-x)$ we get the following:
$$\int\delta(x-x'')*\delta(x''-x)dx''=\int\delta(x'-x)dx''=\delta(x'-x)\int dx''\tag{6}$$
(I remind that the integral is from $-\infty$ to $+\infty$). So I get that
$$\langle x|x'\rangle=\delta(x'-x)\int dx''\tag{7}$$
which is not just $\delta(x'-x)$. I would be grateful if someone could tell me where my assumptions are wrong and why.