On 15.06.2012 17:43, Robert Arlavi wrote: > field_value8:=UTF8Encode('5% - 95'); > xmlTextWriterWriteFormatAttribute(Writer,PAnsiChar(field_name8),PAnsiChar(field_value8)); > xmlTextWriterWriteFormatAttribute expects a string with format specifiers similar to C printf() (see http://en.wikipedia.org/wiki/Printf_format_string). This means that the '%' has a special meaning. To output a literal '%' you must double it: '%%'. You can output strings and decimal numbers using %s and %d. Here is an example from my DUnit test suite: var Buf: xmlBufferPtr; pName, pValue, pArg: C_char_ptr; nArg: C_int; Writer: xmlTextWriterPtr; begin Buf := xmlBufferCreate; Writer := xmlNewTextWriterMemory(Buf, 0); xmlTextWriterStartDocument(Writer, nil, 'UTF-8', nil); pName := 'Element'; xmlTextWriterStartElement(Writer, pName); pName := 'Attribute'; pValue := '%% %s %d'; pArg := 'Arg'; nArg := 98765; xmlTextWriterWriteFormatAttribute(Writer, pName, pValue, pArg, nArg); xmlTextWriterEndElement(Writer); xmlTextWriterEndDocument(Writer); CheckEquals( '<?xml version="1.0" encoding="UTF-8"?>' + #$A + '<Element Attribute="% Arg 98765"/>' + #$A, Buf.Content); xmlFreeTextWriter(Writer); xmlBufferFree(Buf); end; If you don't need the formatting functionality, use xmlTextWriterWriteAttribute() instead: function xmlTextWriterWriteAttribute( Writer: xmlTextWriterPtr; const Name: xmlCharPtr; const Content: xmlCharPtr): C_int; Ralf _______________________________________________ Delphi Inspiration mailing list yunqa@xxxxxxxxxxxxx //www.freelists.org/list/yunqa