Integral of Tan(x) is -ln(cos(x)) which has a singularity at x=pi/2 (and 3/2 pi, 5/2 pi etc). So the integral from 0 to x=pi/2 would be oo.
Although, you can calculate the Cauchy principal value (limit for x-> pi/2) of the integral from 0 to pi, which is 0.
Hopefully not to confusing eplained...