[xml] xmlwriter, attributes and encoding
- From: Rob Richards <rrichards ctindustries net>
- To: xml gnome org
- Cc: veillard redhat com
- Subject: [xml] xmlwriter, attributes and encoding
- Date: Tue, 15 Aug 2006 19:06:48 -0400
When using xmlwriter attributes , document encoding that has been set is
not passed to xmlAttrSerializeTxtContent, so character references are
written when needed.
The xmlDocPtr passed to xmlAttrSerializeTxtContent is only used to check
encoding, so I was wondering if the code in the attached patch is fine
to fix this (it fakes a document so any changes within
xmlAttrSerializeTxtContent to manipulate the passed document could
possibly blow up - though i dont see any need/reason to ever do this).
Rob
Index: xmlwriter.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xmlwriter.c,v
retrieving revision 1.36
diff -c -r1.36 xmlwriter.c
*** xmlwriter.c 27 Apr 2006 08:10:25 -0000 1.36
--- xmlwriter.c 11 Aug 2006 20:02:29 -0000
***************
*** 1425,1432 ****
break;
case XML_TEXTWRITER_ATTRIBUTE:
buf = NULL;
! xmlAttrSerializeTxtContent(writer->out->buffer, NULL,
! NULL, content);
break;
default:
break;
--- 1425,1441 ----
break;
case XML_TEXTWRITER_ATTRIBUTE:
buf = NULL;
!
! if (writer->out->encoder) {
! xmlDoc doc;
! memset(&doc, 0, sizeof(xmlDoc));
! doc.encoding = (xmlChar *)writer->out->encoder->name;
! xmlAttrSerializeTxtContent(writer->out->buffer, &doc,
! NULL, content);
! } else {
! xmlAttrSerializeTxtContent(writer->out->buffer, NULL,
! NULL, content);
! }
break;
default:
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]