Menu

Can TinyXML parse a string of XML data?

Developer
2009-10-19
2013-05-20
  • Chris Wodarczyk

    Chris Wodarczyk - 2009-10-19

    I am asking this question to see whether TinyXML supports parsing a string of XML data which is NULL terminated as well as files?  The only reason I ask is I attempted the following:

    `const string xmlData = "…………..";`
    `TiXmlDocument xmlStream;`
    `const char * pReturn = xmlStream.Parse(xmlData.c_str());`
    `if(pReturn != NULL)`
    `{`
    `    TiXmlNode * pNode = xmlStream.FirstChild();`
    `    assert(pNode != NULL);`
    `}`

    The first logical check passes, so the function isn't returning NULL to indicate failure… but the first child is always NULL.  Attempting to print an error with ErrorDesc() prints an empty string.  Is this even supported?  And, just in case you ask, no, xmlData is not actually …… :)

     
  • Chris Wodarczyk

    Chris Wodarczyk - 2009-10-19

    Actually… nevermind… I guess I needed to add newlines to each XML line… it appears to work now. 

     

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.