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?

First we use integration by parts, Let $$f(x)=x\sec x\text{ and } g(x)=\frac{x\cos x}{(x\sin x+\cos x)^2}$$ 
And as ac onsequence: $$G(x)=\frac{-1}{x\sin x+cosx} \text{ and }f'(x)=\sec x+x\sec x \tan x$$ and we have:
$$\begin{align}\int f(x)g(x)&= f(x)G(x)-\int f'(x)G(x)\\ \\
                            &=\frac{-x\sec x}{x\sin x +\cos x }+\int   \frac{\sec x+x\sec x\tan x}{x\sin x+\cos x}\\ \\
&=\frac{-x\sec x}{x\sin x +\cos x }+\int \sec^2 x\\ \\
&=\frac{-x}{\cos x(x\sin x +\cos x) }+\tan x\\ \\
&=\frac{-x+\sin^2 x(x \sin x+\cos x)}{\cos x(x\sin x +\cos x)} \end{align}$$
Answer : $$\frac{\sin(x)-x\cos(x)}{x\sin(x)+\cos(x)}+C$$
