decode xml from string using tinyxml

Swarp Zone
  • Swarp Zone

    Swarp Zone - 2009-07-13

    I am trying to decode a string using tinyxml and so far, the only way i can do that is to load the string into a document before i am able to decode it. Is there any other way? loading it to a file is extremely slow as the xml string is being sent through the port to my program at an extremely fast rate. If it is not possible, are there an other xml libraries that will let me do that? Hope that someone can help me as soon as possible!!! thank you!

    • Swarp Zone

      Swarp Zone - 2009-07-15

      ok.. I implemented a quick fix solution to the issue. here's wat I did
      1. suppose the xml data received over the socket is in the variable 'msg'.
      2. created a TiXmlDocument doc with a random input file name "tmp.xml"
      3.  then do doc.Parse(msg);

      The data in the msg is now part of 'doc' an you can use doc like you would after reading from an input file!

      • Jeremy A

        Jeremy A - 2009-07-16

        It is easy to use in-memory construction

        TiXmlDocument doc ( charpointer );


        TiXmlDocument doc ( xmlstring.c_str() );

  • Sagar

    Sagar - 2009-09-30

    Hi, I want to parse a xml file using tinyxml and put all the information into a data structure so that I can use it in another function. Can anyone have any idea or suggestion how I can do it. I am really new in tinyxml and C++.


Log in to post a comment.