[xslt] Re: [xml-bindings]Python version of encodeEntitiesReentrant

On Mon, Jun 16, 2003 at 04:42:12PM +0200, Le grande pinguin wrote:
> Hello Daniel, hello list,
> i just read the following in the docstring of 
> `encodeEntitiesReentrant()' in file `libxml2.py':
> """Do a global encoding of a string, replacing the predefined
>    entities and non ASCII values with their entities and
>    CharRef counterparts. Contrary to xmlEncodeEntities, this
>    routine is reentrant, and result must be deallocated. """
> How would i deallocate the result of this function? As far as i can
> tell it return a python string object.

  Hum, the documentation string comes from the C function description.
I thing the binding code actually transform the result to a Python
string object and free the xmlChar * using xmlFree().
  In practice, the generated wrapper function
    libxml_xmlEncodeEntitiesReentrant() in libxml2-py.c 
calls libxml_xmlCharPtrWrap() wiith the result and that routine
does that :

      ret = PyString_FromString((char *) str);


Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

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