This can nowadays be done, with a certain amount of clever macro programming. David Carlisle's xmltex is the prime example; it offers a practical solution to typesetting XML files.
One use of a TeX that can typeset XML files is as a backend processor for XSL formatting objects, serialized as XML. Sebastian Rahtz's PassiveTeX uses xmltex to achieve this end.