On Wed, Jul 11, 2007 at 01:28:51PM -0400, Daniel Veillard wrote: > On Wed, Jul 11, 2007 at 07:01:33PM +0200, Frank Gross wrote: > > Hi, > > > > I was using libxml xmlOutputBufferWrite function, but I found out > > that when the encoder is not UTF-8, the function doesn't work. I wrote > > my own function similar to libxml's one, excepted that I removed the > > following two lines of code: > > > > /* if ((out->buffer->use < MINLEN) && (chunk == len)) goto done; */ > > > > and > > > > /* if ((nbchars < MINLEN) && (len <= 0)) goto done; */ > > > > Without those two lines, the function works well even if encoder is not > > UTF-8. > > > > Can someone tell me why these goto instructions are needed ? Or if I > > missed something ? > > You missed that running the encoder is costly, and doing it by large chunk > is way more efficient than piece by piece. Oh you also missed the Flush > and Close operations, i.e. you didn't took the time to understand how the > code worked I guess.
Hum, that was a bit harsh, sorry ! Still I think what you missed is xmlOutputBufferFlush() http://xmlsoft.org/html/libxml-xmlIO.html#xmlOutputBufferFlush Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
