[xml] libxml2 -- xmlDocDumpMemory and xmlSaveFile output is only one line



Hello xml,

I notice that the different behaviour of libxml under Linux and
Windows.

I build a tree using the revised example at http://xmlsoft.org/.
And dump it to memory or save it to file using

xmlDocDumpMemory()  xmlSaveFile()

Under linux, the output is '\n' seperated after each closing </tag>.
But under Windows, except the "<?xml version="1.0"?>\n", all other
output is in one line, then '\n' to end

The libxml2 I use under linux is libxml2-2.3.4-1mdk in mandrake.
The Windows 2000 use libxml2-2.4.4.

A close look into source ( tree.c ), at function xmlNodeDumpOutput()
--snip--
    if (cur->children != NULL) {
        if (format) xmlOutputBufferWriteString(buf, "\n");
        xmlNodeListDumpOutput(buf, doc, cur->children,
                        (level >= 0?level+1:-1), format, encoding);
        if ((xmlIndentTreeOutput) && (format))
            for (i = 0;i < level;i++)
                xmlOutputBufferWriteString(buf, "  ");
    }
--snip--

So the difference is default
Linux+libxml2-2.3.4:    format ==1
Windows+libxml2-2.4.4:  format ==0

-- 
  lark






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