I'm having problems getting useful error messages parsing an XML document from a string. I've tried both TiXmlDocument.Parse and istringstring >> TiXmlDocument.
If I pass in invalid XML data I get the following results
I've gone back and attempted to reproduce the case where the stream operator was not giving my a valid ErrorDesc() but unfortunately I didn't save it.
I think some of my confusion was due to the ErrorDesc itself. I was parsing a string that looks like "aaa<test></test>" and did not expect an error message of "Error document empty." - I was hoping for something a little more descriptive. For example, IE gives the following error -
Invalid at the top level of the document.
and Firefox gives-
XML Parsing Error: not well-formed
both of which I find more helpful than the TinyXML error.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm having problems getting useful error messages parsing an XML document from a string. I've tried both TiXmlDocument.Parse and istringstring >> TiXmlDocument.
If I pass in invalid XML data I get the following results
Parse()
doc.Error() = true
doc.ErrorDesc = Error document empty.
doc.ErrorId = 13
>> TiXmlDocument
doc.Error() = true
doc.ErrorDesc = null
doc.ErrorId = 13
Is there any way to get useful error messages out of the library?
Do you mean it works with "Parse()" but not ">>" ?
lee
I've gone back and attempted to reproduce the case where the stream operator was not giving my a valid ErrorDesc() but unfortunately I didn't save it.
I think some of my confusion was due to the ErrorDesc itself. I was parsing a string that looks like "aaa<test></test>" and did not expect an error message of "Error document empty." - I was hoping for something a little more descriptive. For example, IE gives the following error -
Invalid at the top level of the document.
and Firefox gives-
XML Parsing Error: not well-formed
both of which I find more helpful than the TinyXML error.