Can you do research in same field as your diploma and another field at the same time?
I'm doing my diploma as an electrical engineer and I will start a phd in operations research. So that's possible.

I think it is a lot about what skills you bring. At first, which skills can be useful for the institution where you gonna start. Also the question is, if your skills are enough for your special phd topic...

If you are a pure mathematican with no skills whatsoever in XML that would be hard. But if you attained some skills in XML on your "pure mathematics" path, it may be possible.