Author Topic: Bad export formatting with XML_TARGET_MODE_MEMORY  (Read 184 times)

Offline DBarzo

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
Bad export formatting with XML_TARGET_MODE_MEMORY
« on: April 28, 2010, 03:36:19 »
Hi,

I noted a strange formatting when the target mode is XML_TARGET_MODE_MEMORY.

With the following code

Code: [Select]
  // Manipulate export format
  XMLEXPORTFORMAT xf = {0};
  xf.UseSpace = true;
  xf.nId = 2;
  xf.ElementsNoBreak = true;
  _xml->SetExportFormatting(&xf);

  size_t size = _xml->MemoryUsage();
  char * buff = new char[size];
  memset(buff, 0, size);
  _xml->Export((FILE*)buff, XML_SAVE_MODE_DEFAULT, XML_TARGET_MODE_MEMORY);

the output is:

<NODE>
  <CHILD1>
text</CHILD1>
  <CHILD2>
text</CHILD2>
<NODE>

where the text is preceded by a CRLF.
If in the code I change the last line with:

_xml->Export(stdout, XML_SAVE_MODE_ZERO);

the output is correct:

<NODE>
  <CHILD1>text</CHILD1>
  <CHILD2>text</CHILD2>
<NODE>

Regards,
Daniele.

Offline Michael

  • Administrator
  • Super Member
  • ******************
  • Posts: 1069
  • Karma: 32
    • TurboIRC.COM
Re: Bad export formatting with XML_TARGET_MODE_MEMORY
« Reply #1 on: April 28, 2010, 06:16:04 »
I 'll take a look, thanks for reporting.