Re: [xml] xmlDocDump() on Windows



Daniel Corbe wrote:
Sorry but I must reject this notion. You're trying to say that it's broken the way I'm using it, but just on Windows? Because like I said on Linux it runs fine.
I am saying that it was either that or you are mixing release and debug versions and probably running into a problem on the HEAP somewhere. Just to make sure this wasn't something new, I did try your example code and it worked flawlessly (hardcoding path names of course and using "wb" for mode as I have no idea what you defined OPEN_MODE_OVERWRITE as).

I used both a debug version of libxml2 and my calling executable. They were both built with VS 2005 and I'll test again later building the executeable against a VC6 version of libxml2.


I'm trying to do something EXTREMELY simple here. See below. In my experience if xmlReadFile fails I get a bunch of things to stderr about why and my program then exists. And I have also verified with a debugger that mtp3 is indeed a valid pointer. So if mtp3 is a valid and parsed and my FILE*xml is also a valid pointer, xmlDocDump would have no reason to fail.

I have attached some screenshots highlighting the failure.

/* Begin code snippet */
xmlDocPtr mtp3;
FILE *xml;

mtp3 = xmlReadFile(config->MTP3filename, NULL, 0);
xml = fopen(config->MTP3filename, FOPEN_MODE_OVERWRITE);
if (!xml || ferror(xml))
{

outputf("ERROR WRITING MTP3 XML File: %s\n", strerror(errno));
}
else
{
xmlDocDump(xml, mtp3);
fclose(xml);
}
Try a debug version of libxml2 and if it crashes then, you should be able to find out why at least because I cannot reproduce your crash.

Rob



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]