After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 131548 - xmlWriter produces invalid xml
xmlWriter produces invalid xml
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2004-01-15 12:39 UTC by Christian Persch
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6


Attachments
testcase (454 bytes, text/plain)
2004-01-15 12:40 UTC, Christian Persch
Details

Description Christian Persch 2004-01-15 12:39:36 UTC
xmlWriter produces invalid output when writing an attribute value with
embedded quotes ("). Consider the output of the attached testcase:

<?xml version="1.0"?>
<root attribute="test"test"/>
Comment 1 Christian Persch 2004-01-15 12:40:06 UTC
Created attachment 23377 [details]
testcase
Comment 2 Christian Persch 2004-01-15 17:25:05 UTC
xmlTextWriterWriteAttribute uses xmlTextWriterWriteString to write the
attribute content. When in state XML_TEXTWRITER_ATTRIBUTE, 
xmlTextWriterWriteString uses xmlEncodeSpecialChars to escape characters.

From entities.c (xmlEncodeSpecialChars):

628 veillard 1.76 #if 0
629 veillard 1.31 	} else if (*cur == '"') {
630               	    *out++ = '&';
631               	    *out++ = 'q';
632               	    *out++ = 'u';
633               	    *out++ = 'o';
634               	    *out++ = 't';
635               	    *out++ = ';';
636 veillard 1.76 #endif

And the checkin comment on rev 1.76 says this was done in response to
bug 127877.
Comment 3 William M. Brack 2004-02-01 10:11:05 UTC
I extracted the serialization of the attribute content from the 
routine used elsewhere with the library and changed xmlwriter to use 
that routine.
bill@bbrack bug131548 $ cat test-writer.xml
<?xml version="1.0"?>
<root attribute="test&quot;test"/>

The changes (include/libxml/tree.h, tree.c, xmlwriter.c) are in 
CVS.  Thanks for the report.
Comment 4 Daniel Veillard 2004-02-12 17:42:37 UTC
This should be closed by release 2.6.6,

  thanks,

Daniel