How to integrate $ \int \frac{x^2}{(x \sin(x)+\cos(x))^2} \mathrm{d}x$ 
Evaluate
$$\displaystyle \int \frac{x^2}{(x \sin(x)+\cos(x))^2} \mathrm{d}x$$

Can someone just tell me the necessary manipulations? Hints will be enough.
Can it be done by integration by parts?

I've used a non-standard method.
1) note that the denominator in the integrand is a square, so I think that the primitive is a fraction (the derivative of a fraction has a square at denominator).
2) I search if there is a simple function that can be the numerator of the fraction, and I search from function of the form
$ \dfrac{ ax \sin x +b \cos x}{x\sin x + \cos x}$
or 
$ \dfrac{ax \cos x +b \sin x}{x\sin x + \cos x}$.
3) the first form does not work, since, deriving, at the numerator we have some $\sin $ and $\cos$ functions.
4) the second form work well. We have, for the numerator of the derived function:
$
(a \cos x-ax \sin x +b \cos x)(x \sin x + \cos x)-(\sin x+x \cos x -\sin x)(ax \cos x +b \sin x)
$
so, if $b=-a$ we have
$
-ax^2\sin x(x \sin x- \cos x)-x \cos x(ax \cos x-a\sin x)=-a(\sin^2 x + \cos^2 x)
$
and for $a=-1$ wh have a primitive:
$ \dfrac{-x \cos x + \sin x}{x\sin x + \cos x}$.
