Menu

Loading XML from memory?

Wirfeon
2007-10-13
2013-05-20
  • Wirfeon

    Wirfeon - 2007-10-13

    I need to load xml from a memory buffer such as c++ string. I couldn't find it in tutorial neither in the code. Can anyone help?

     
    • Ellers

      Ellers - 2007-10-13

      Somehow I missed that on the tutorial. I'll add it in. Its obvious once you know:

      TiXmlDocument doc;
      doc.parse("<greeting>Hello</greeting>");

      http://www.grinninglizard.com/tinyxmldocs/classTiXmlDocument.html#a14

       
      • Filipe

        Filipe - 2008-07-16

        There's some way to make a partial parse??? My problem is that I am receiving the data from a socket and adding it all into a buffer... Then I call Parse passing that buffer's... but when I have 1 complete xml stream and a half of the second I think that the things will not go well...

        example:

        <data><a="aaaa"/><b="bbbb/></data><data><c="cccc"/>... ( and the socket stopped sending data )...

        I think that the parse method could stop as soon as it detect the end of the XML ( in this case, when it sees the </data> that is the finishing root element ) and return the pointer to where it stopped reading... this way, the calling function can know and buffer that data back to wait for more data...

        Anyone has suggestions ?

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.