Menu

#1 Parse EXI and create xml with one API  Edit

open
nobody
1
2019-06-14
2011-03-24
nku
No

Parsing exi and Creating XML with just one API without worrying about the multiple callbacks would be really handy. I tried that out by doing the same as you did in the decoder example. Basically, in the contentHandler structure I added a placeholder for a buffer to hold xml. Also some other variables to hold the state. Modified in grammers.c to fill the buffer for xml wherever the callbacks are being called (used push and pop functions just like in decoder example). Very nasty hack maybe, but served the purpose. It will be great if you could maybe do it in a better manner ( as my understanding of the code is not complete).

Regards,
Naren

Discussion

  • Rumen Kyusakov

    Rumen Kyusakov - 2011-03-24

    Hi,

    thanks for the comments. This feature was discussed few times already when we started the project. I fully understand your point and agree that in some cases EXI to XML is useful to have in the parser. I will not go into details, but I will try to point out why I am against the solution you suggested:

    • Not all applications will need to work with plain XML representation.
    • Embedding plain XML parsing/serializing the way you suggested is hard to remove from the build if you don't really need it which I believe is the case for most of the applications we are targeting
    • Full support for the text XML output require quite a bit more than what it is in the decoder example:
      - XML namespaces are not handled correctly there
      - you need to ensure some streaming capabilities - not always a fixed size buffer for the XML will work

    However it is quite straight forward to implement such functionality as a separate module using the EXIP API. As you said, very similar to decoder example. Just to throw some ideas here:
    - You can create a function, say convertEXI() that gets almost the same parameters as parseEXI() but also a buffer and output streaming handles for writing text XML output
    - In this function you use the parseEXI() and the content handler callbacks to write XML and send it to the application calling the convertEXI()

    As this is not a priority for us at the moment I don't believe we will work on that in near future. If you want to work on such module, and contribute it to the project I will gladly help with whatever I can.

    Regards,
    Rumen

     
  • Anonymous

    Anonymous - 2019-06-14

    hi Rumen
    if have plan to encode to exi? now i have used the exip libray,and neet to encode xml to exi and decode exi to xml

     

Anonymous
Anonymous

Add attachments
Cancel