Quantum expressions involving Dirac delta function 
I want to find the following quantum expression:
$$ \langle x|PX|x'\rangle.$$

A. If I use $X|x'\rangle = x'|x'\rangle $, I will get:
$$ \langle x|PX|x'\rangle = \langle x|Px'|x'\rangle = x'\langle x|P|x'\rangle = x'\frac{\hbar}{i}\frac{\partial}{\partial x} \langle x|x'\rangle = x'\frac{\hbar}{i} \delta'(x-x').$$
B. But If I start from the other side I will find:
$$ \langle x|PX|x'\rangle = \frac{\hbar}{i}\frac{\partial}{\partial x} \langle x|X|x'\rangle = \frac{\hbar}{i}\frac{\partial}{\partial x} (x\langle x|x'\rangle) = \frac{\hbar}{i}(\delta(x-x')+x\delta'(x-x'))$$
Also using $XP-PX = i\hbar$:
$$ \langle x|PX|x'\rangle = \langle x|XP-i\hbar|x'\rangle = \langle x|XP|x'\rangle -i\hbar\langle x|x'\rangle = x\langle x|P|x'\rangle -i\hbar\langle x|x'\rangle = \frac{\hbar}{i}(\delta(x-x')+x\delta'(x-x')).$$
I don't know which answer is correct.
 A: As @Qmechanic points out in the comment above, they are both correct. This is because they are both equivalent.
I'm not an expert at the rigorous math, but the way I think about it is that "functions" like the Dirac Delta are actually distributions, meaning that they only make sense inside of an integral of the form:
$$\int_{a}^b \text{d}x\,\,f(x)\delta(x),$$
for any arbitrary $f(x)$ is an arbitrary test function that is "well-behaved" (smooth, with a compact support over the interval, etc.).
In this sense, we can show that both the quantities that you have derived are equal, in the sense that (let's ignore all factors of $\hbar$ and $i$ since they're the same on both sides anyway) $$\int_{-\infty}^\infty \text{d}x\,\,\, x' \delta'(x-x') f(x) = \int_{-\infty}^\infty \text{d}x\,\,\, \Big(\, \delta(x-x') + x \delta'(x-x')\,\Big) f(x),$$
for every test function $f(x)$. The math isn't too hard to do, but I'll outline it here anyway.
Evaluating the LHS
the left hand side is pretty easy to evaluate (remember, $x'$ is a constant)
$$\int_{-\infty}^\infty \text{d}x\,\,\, x' \delta'(x-x') f(x) = x' \int_{-\infty}^\infty \text{d}x\,\,\, \delta'(x-x') f(x) = - x' f'(x'), \tag{1}\label{1}$$
where I've used the well known result that $$\int_{-\infty}^\infty \text{d}x\,\, \delta'(x-x') f(x) = -\frac{\text{d}f(x)}{\text{d}x}\Bigg|_{x=x'}.$$
Evaluating the RHS
Now, let's look at the right hand side. You can break the sum into two parts, the first of which is trivially $f(x')$, by the definition of the $\delta$ function. The second term is more interesting:
$$\int_{-\infty}^\infty \text{d}x\,\,\, x \delta'(x-x') f(x)$$
It almost looks like the left-hand-side of Equation (\ref{1}), except that instead of $x'$ here you have $x$. But $x$ isn't a constant, and it shouldn't be too hard for you to see (using the relations we've used above) that
$$\int_{-\infty}^\infty \text{d}x\,\,\, x \delta'(x-x') f(x) = -\frac{\text{d}}{\text{d}x}\left(x f(x)\right)\Bigg|_{x=x'} = -f(x') - x'f'(x')$$
Plugging the two terms together, the RHS is thus just: $$\int_{-\infty}^\infty \text{d}x\,\,\, \Big(\, \delta(x-x') + x \delta'(x-x')\,\Big) f(x) = -x' f'(x').\tag{2}\label{2}$$
Since Equations (\ref{1}) and (\ref{2}) are the same, we can say that the two distributions are "equal". So to answer your question, they are both right, as they should be.
A: The equivalence of OP's two methods A & B follows from the following identity
$$ \{f(y)-f(x)\}~\partial_x \delta (x-y)~=~ \delta  (x-y) ~f^{\prime}(x)\tag{1} $$
for the Dirac delta distribution, where $f\in C^{\infty}(\mathbb{R})$. Eq. (1) in turn follows from differentiation of the identity
$$ \{f(y)-f(x)\}~ \delta (x-y)~=~ 0.\tag{2} $$
