Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I just noticed a important restriction: $X \setminus X_i$ needs to be connected for this to work out. A counterexample would be a $\mathbb{P}^1$ intersecting three curves of genus bigger then 0, lets say in $0, 1$ and $\lambda$. Then the coordinate function $x/y$, extended by $0, 1$ and $\lambda$ on the rest of the curve would have a single pole at infinity. So your statement is true if and only if every rational component is part of some cycle of the dual graph.