Can TinyXML parse a string of XML data?

  • 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 …… :)

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