[xml] xmlTextWriter writes invalid xml


there seems to be a bug in xmlTextWriter. [I've filed this last week as 
http://bugzilla.gnome.org/show_bug.cgi?id=131548 , but since it hasn't
received a response yet, I thought I'd ask about it on the ML.]

The problem is that it silently writes invalid xml when you write an
attribute with quotes (") in it:

        xmlTextWriterWriteAttribute (writer, "attribute", "test\"test");

produces this in the output:


This is because  xmlTextWriterWriteAttribute uses
xmlTextWriterWriteString to write the attribute content. When in state
XML_TEXTWRITER_ATTRIBUTE, xmlTextWriterWriteString uses
xmlEncodeSpecialChars to escape characters. And xmlEncodeSpecialChars
does _not_ encode " as " as per the fix for bug

Full testcase attached.


Attachment: xmlwriter.c
Description: Testcase

Attachment: test-writer.xml
Description: Output of testcase

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