I am trying to find a better solution to convert a plain text (but with predefined lengths for each field) to xml. For example the input text can be \"Testuser new york
XSLT 2.0 is highly suitable for converting structured text to XML. You might like to the 2010 paper by Stephanie Haupt and Maik Stuehrenberg here:
http://www.balisage.net/Proceedings/vol5/html/Haupt01/BalisageVol5-Haupt01.html
or my own 2008 paper
http://www.saxonica.com/papers/ideadb-1.1/mhk-paper.xml
for case studies.
I wouldn't normally attempt the task using XSLT 1.0, though as Dimitre's answer shows, it can be done in simple cases.