Is xslt good approach to convert text to xml structure?

前端 未结 2 2087
夕颜
夕颜 2021-01-01 06:50

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

2条回答
  •  佛祖请我去吃肉
    2021-01-01 07:22

    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.

提交回复
热议问题