OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] Genx

[ Lists Home | Date Index | Thread Index ]

> Joe Gregorio:
> > David Tolpin wrote: 
> > > passing data in buffers oftern requires number of bytes or characters to be passed;
> > > consider getting data from Expat and writing it to the output.
> > > 
> > > int genxText(genxWriter w, const utf8Byte * text, int nbytes);
> > > int genxTextW(genxWriter w, const codePoint * text, int nchars);
> > 
> > This is a C interface and null terminated strings are
> > the standard way of handling this, the nbytes would
> > just be redundant information. If the implmentation of
> > genxText() needs the length it can call strlen(text), 
> > if it doesn't need the length then why force it to 
> > be passed in?
> Have you looked at the API of James Clark's Expat?

The reason there is that (especially) character data are passed
through pointers into an internal working buffer. Having a null
terminator in the API would effectively force Expat to allocate
a new copy of the string.

Could there be a similar siutation for a writer API?
Possibly yes - as it is conceivable that the data to be
written out are part of some larger text/structure and
there is no reason to force a new string allocation on the caller.



News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS