Help with calculating a Riemann-Stieltjes integral. The question is to calculate

$\int_{ - 1}^2 {xd\omega (x)}  = 0$ where $\omega (x) = \left\{ {\begin{array}{*{20}{c}} 0&{1 \le x \le 2}\\ 1&{0 \le x < 1}\\ 2&{ - 1 \le x < 0} \end{array}} \right.$

$f(x)=x$ is continuous, and $\omega(x)$ is of bounded variation (since it is bounded decreasing), then $\int_{ - 1}^2 {xd\omega (x)} $ exists. It has been pointed out that the following calculation is incorrect since $\phi$ has discontinuity. I also checked my textbook which states differentiation of $\phi$ holds only when $\phi$ is continuously differentiable.

$\int_{ - 1}^2 {xd\omega (x)}  = \int_{ - 1}^0 {xd\omega (x)}  + \int_0^1 {xd\omega (x)}  + \int_1^2 {xd\omega (x)}  = 0 + 0 + 0 = 0$.

Then what is the right way to calculate this integral if we cannot use derivative? Integration by parts? Or other method? Thank you!

Previous problem.
Then I have a problem with a theorem in my textbook. The theorem is attached below, where $\int_E f $ is a Lebesgue integral on set $E$, and $\omega(\alpha)=\mu\{x\in E:f(x)>\alpha\}$.

Now suppose $\Omega =[0,2]$ is the whole set and $(\Omega,\cal M)$ is a measure space where $\cal M$ is the set of all Lebesgue measurable subsets of $\Omega$. Function ${\chi _{[0,1]}}(x) = \left\{ {\begin{array}{*{20}{c}}
1&{x \in [0,1]}\\
0&{x \notin [0,1]}
\end{array}} \right.$ is Lebesgue measurable. Since $ - 1 < {\chi _{[0,1]}}(x) \le 2$ on $[0,2]$, then by the above theorem it looks that we have

$\int_\Omega  {{\chi _{[0,1]}}(x)}  =  - \int_{ - 1}^2 {\alpha d\omega (\alpha )} $

It is clear that $\omega (\alpha ) = \mu (\{ x \in \Omega :{\chi _{[0,1]}}(x) > \alpha \} ) = \left\{ {\begin{array}{*{20}{c}}
0&{1 \le \alpha  \le 2}\\
1&{0 \le \alpha  < 1}\\
2&{ - 1 \le \alpha  < 0}
\end{array}} \right.$, so I think the right-hand-side $ - \int_{ - 1}^2 {\alpha d\omega (\alpha )} = 0$. But the left-hand-side $\int_\Omega  {{\chi _{[0,1]}}(x)}  = 1$ by Lebesgue integration.
The theorem in the textbook is definitely correct, so what's wrong with my reasoning?? Thank you!
 A: The definition of the Riemann-Stieltjes integral is
$$
\int_a^b f d\omega(x) = \lim_{n\to \infty} \sum_{i=0}^{n-1} f(x_i^*)[\omega(x_{i+1})-\omega(x_i)]
$$
where $x_i^*\in I_i = [x_i,x_{i+1}]$ and the limit is such that the size of the largest interval approaches zero, and $x_0=a, x_n=b$.
Clearly, in your case, for all the intervals $I_i$ that do not contain 0 or 1, everything is trivial, since $\omega(x_{i+1})-\omega(x_i)=0$. For the critical intervals containing 0 and 1, things are different, but not hard. In particular, you get $\omega(x_{i+1})-\omega(x_i)=-1$ for both the (only) two intervals containing 0 and 1, call them $I_{i_0}$ and $I_{i_1}$. Furthermore, as the intervals shrink, you have that $x_{i_0}$ approaches 0 and $x_{i_1}$ approaches 1. Therefore,
$$
\int_{-1}^2 f(x)d\omega(x) = -f(0) - f(1).
$$
In your case, $f(x)=x$, hence the integral is -1.
Edit: I did not see the second part of the question (with the Lebesgue integral), but the fact that the given integral is -1 should be enough to clarify where the flaw in your argument was.
Side note: assuming you're familiar with distributions, in a distributional sense, $d\omega(x)$ could be thought of as $d\omega(x)=-\delta(x)-\delta(x-1)$, where $\delta$ is the Dirac's delta distribution. In this framework, the "integral" would just be the (well defined) pairing between $d\omega$ and the $\mathcal{C}^{\infty}$ fuction $x$. Note: this is not a rigorous way to compute Riemann-Stieltjes integrals for discontinuous $\omega$, but it gives you an insight of what pieces you are missing when you split $[a,b]$ into intervals where $\omega$ is continuous...
