[xml] program crash, how to debug?



Hi,

for a program i wrote one function to write data as XML into a file
and one function to read the data back from a file.

The XML that is written to a file looks as i expect it. Also, when
i read it back and display the memory structures the also look ok.

I call LIBXML_TEST_VERSION once and xmlInitParser also only once
at the startup of my program.

But when i read data from an XML file and then immediately write
data back (using my functions) i get a program crash in the
write-function.
To be more precise, i do not load an xmlDocument and write that
xmlDocument back but use my functions for that:

Load-function:
- load an xmlDocument
- interpret its content and fill some of my memory structures with it

Write-function:
- create an xmlDocument in memory from my data structures
- write that xmlDocument to file system


The thing that seems to crash my program is:
  xmlNewProp(node, BAD_CAST "flags", BAD_CAST buff);

"node" was created before and is not NULL.  "buff" is a
char buffer that contains "0" (zero terminated).

A call to xmlGetLastError() right before that call returns NULL.


Has anybody got an hint on how to debug this?

Are there any special functions to see if libxml2 data are
consistent?  Or any other functions that could help?


Best regards,
Torsten.



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