parse a xml in c++

前端 未结 3 1437
死守一世寂寞
死守一世寂寞 2021-01-26 12:37

i want to parse a xml like that. My output need to be a code in c or c++ who make the transformation of each letter in phoneme. I introduce a word at input and my generated code

相关标签:
3条回答
  • 2021-01-26 13:21

    First use an XML parser (for example Xerces, Expat or TinyXML) to parse your XML file and build a data structure for input transformation. Probably it will be a list of objects each representing a pattern to match and the desired output. Then iterate over the letters in your word matching them against the patterns. If the number of patterns is large you may want to have a map from letter to the list of patterns that apply to it.

    0 讨论(0)
  • 2021-01-26 13:36

    For a fast xml parser which just needs to be dumped in to your project without dependencies, I highly recommend TinyXML.

    http://www.grinninglizard.com/tinyxml/

    0 讨论(0)
  • 2021-01-26 13:41

    I usually use lex/yacc or ANTLR for parsing related suff. ANTLR is very easy to learn/code.

    0 讨论(0)
提交回复
热议问题