[xslt] Re: [xml-bindings]Python version of encodeEntitiesReentrant
- From: Daniel Veillard <veillard redhat com>
- To: Le grande pinguin <rm mh-freiburg de>
- Cc: xslt gnome org, xml-bindings gnome org
- Subject: [xslt] Re: [xml-bindings]Python version of encodeEntitiesReentrant
- Date: Tue, 17 Jun 2003 05:31:42 -0400
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);
xmlFree(str);
Daniel
--
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]