craq
craq

Reputation: 1502

XML - parsing file returns NULL

Yesterday I could parse XML files with a program written in C, using the function doc = xmlParseFile(fname);.

Now, it returns NULL (which gets caught on the next line, returning an error). The program hasn't been changed for over a month, the XML files haven't changed since last week and libxml2 hasn't changed since the 25.3.2012. xmllint runs through the files with no problem, and I can parse them on another computer (Solaris, using the same source code, but a different compiler and library). So what else should I check? It sounds similar to this thread, although I'd like to avoid that hacky solution http://ubuntuforums.org/showthread.php?t=1402824 (haven't tried it yet)

The C program is actually a mex function called from MatLab, but that shouldn't make any difference, right? I am running this on GNU/Linux.

Upvotes: 0

Views: 1167

Answers (1)

Peter Miehle
Peter Miehle

Reputation: 6070

try this:

  FILE *f = fopen("~/myxml.log", "a");
  xmlSetGenericErrorFunc(f, NULL);
  doc = xmlParseFile(fname);
  fclose(f);

and look on the results in the log-file.

Upvotes: 1

Related Questions