On Tue, Aug 26, 2014 at 12:30:01PM +0000, Jean-Philippe Jacoupy wrote:
> Hello, 
> 
> I'm using libxml2 and I have a strange behaviour. 
> 
> I'm creating a full document in memory (using xmlTextWriter with a 
> xmlBuffer). 
> 
> I have called xmlTextWriterSetIndent with 0 as parameter. 
> 
> Whenever I get the buffer content (once I have called
> xmlTextWriterEndDocument) I get strange 0x0a inserted: 
>  - 1 after the xml header
>  - 1 after the end of the xml document
> 

  It's not strange, that a new line character, which is present
as non-significant white space and will be ignored by XML parsers
and hence the whole tool chain consuming the output.

Daniel

> I'm under Windows compiling with VS2008 against LibXML2 version 2.7.2
> 
> PS: 
> - As I searched the code of the libxml2, at the end of the
> xmlTextWriterStartDocument function I have found this: 
> 
> count = xmlOutputBufferWriteString(writer->out, "?>\n"); (L. 617)
> 
> Shouldn't the '\n' be prefixed by a if (writer->indent) ? 
> 
>  - Found the other one in xmlTextWriterEndDocument I have found: 
> 
> if (!writer->indent) { (L. 701)
> 
> instead of 
> 
> if (writer->indent) {
> 
> as done in all the file. 
> 
> _______________________________________________
> xml mailing list, project page  http://xmlsoft.org/
> xml@gnome.org
> https://mail.gnome.org/mailman/listinfo/xml

-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veill...@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
https://mail.gnome.org/mailman/listinfo/xml

Reply via email to