Re: [xml] xmlEncodeSpecialChars vs xmlEncodeEntitiesReentrant



On Wed, Feb 10, 2010 at 07:39:03PM +0300, Nikolay Sivov wrote:
On 2/10/2010 19:12, Daniel Veillard wrote:
On Wed, Feb 10, 2010 at 06:15:38PM +0300, Nikolay Sivov wrote:
Both calls have a header comment about their reentrance capability.
Is it a comment bug?

Does reentrant in this case mean that I can pass a string already
encoded with xmlEncodeEntitiesReentrant
to this call again?
  no it's related to xmlEncodeEntities() deprecated function which used
a global variable for doing the conversion and hence was not
thread-safe.

Also it's not clear how to deal with a case my string is already
escaped, or partially escaped for example.
Looks like these helpers will break it converting from "&" to
"&"...

  Yes, in general escaping forces you to know where the string is
coming from and whether escaping was already done... that's no different
in libxml2 APIs than elsewhere. Sometimes you realy want &
for example if wou write (X)HTML examples in a tutorial about XML syntax.
The library has no way to guess...

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]