[xml] xmlReadMemory : error "Extra content at the end of the document"
- From: Andrew Hartley <andrew hartley bcs org uk>
- To: xml gnome org
- Subject: [xml] xmlReadMemory : error "Extra content at the end of the document"
- Date: Thu, 13 Nov 2008 09:33:49 -0800 (PST)
I have written a DLL with a large (size = 1318109 chars) XML stored as a
resource. I read the XML into a std::string and load it with a call to
xmlReadMemory:
xmlDocPtr pXmlDoc = xmlReadMemory(sXml, sXml.length(), "xml", NULL, 0);
This works fine in Debug mode. But when I switch to Release mode I get NULL
returned and the error text is "Extra content at the end of the document".
I have tried parsing the std::string content into a char*, and setting the
argv[3] to "UTF-8":
int nLen = (int)sXml.size();
char* pszContent = new char[nLen +2];
strcpy_s(pszContent, nLen +2, sXml.c_str());
pszContent[nLen] = '\n';
pszContent[nLen +1] = '\0';
xmlDocPtr pXmlDoc = xmlReadMemory(pszContent, nLen, "xml", "UTF-8", 0);
delete[] pszContent;
pszContent = NULL;
But I still get the same error!
I have not resorted to attemting to debug through LibXml2 yet, and would
appreciate any advice.
--
View this message in context:
http://www.nabble.com/xmlReadMemory-%3A-error-%22Extra-content-at-the-end-of-the-document%22-tp20484750p20484750.html
Sent from the Gnome - Lib - Xml - General mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]