Daniel Veillard <veillard redhat.com> writes:
> On Sun, Jan 14, 2007 at 02:40:49PM +0000, Nic James
Ferrier wrote:
>> I've got a document loader implemented in python
that handles xml or
>> html documents thus:
>>
>>
>> if re.match("^[a-z]+://.*", url):
>> cached_file, header =
hapi_lib.httputils.url_retrieve(url)
>> if header["content-type"] ==
"text/html":
>> doc =
parserContext.htmlCtxtReadFile(cached_file,
"UTF8", 0)
>> else:
>> # Guess that it's XML
>> doc =
parserContext.ctxtReadFile(cached_file, "UTF8",
0)
>>
>> The HTML works fine until I come to free the
transformContext that
>> this is all done within.
>>
>> When I do I get a glibc error and my process
segfaults.
>
> How do you free it ? And what how is that piece of
code related to a
> transformContext, I don't see any ?!? A transformation
context made from
> a document consumes the XSLT document, if you free it
it will die when
> python reclain the transformation context. But I see no
relationship to
> HTML or XML parsing of *transformed* document.
The code shown is in the loader.
The loader is set... and then:
- a stylesheet is created,
- a transformContext is created
- the stylesheet is applied using the transformContext
(causing the
document loader to be called with XML and HTML resources
requested)
- the result is obtained
- the result is serialized to a string
- the result is printed
- the transformContext is freed
and then it segfaults.
It's only the calls to the HTML parsing code that cause the
free-ing
of the transformContext to fail.
--
Nic Ferrier
http://www.tapsellfer
rier.co.uk for all your tapsell ferrier needs
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|