On Mon, Jan 15, 2007 at 02:26:26PM +0000, Nic James Ferrier
wrote:
> Daniel Veillard <veillard redhat.com> writes:
>
> > what is pctx ??? i find suspicious the fact you
could provide a C parser
> > context here.
>
> It's supplied to the loader implementation function,
which is what
> this is.
>
> I thought the advice was that you had to use the parser
context
> functions from a loader.
The loader should not parse. It should return the input to
parse, in
python the string c.f. the examples.
> >> doc = None
> >> if url == "/one":
> >> doc =
parserContext.htmlCtxtReadFile("file2.html",
"UTF8", 1)
> >> else:
> >> doc =
parserContext.ctxtReadDoc("""<document>
> >
> > just use htmlReadFile and forget about trying to
address directly the
> > parser context. With python overhead you won't
gain anything to create
> > a separately accessible object. The less you touch
things though Python
> > the better it will be, really. That said HTML
parsing works for me when
> > using htmlReadFile.
>
> I tried this and it does work.
>
> But I get a memory leak. Not sure what the memory leak
is... and it
> seems to be there if I use just the context stuff.
The context is passed in the callback to be able to
identify what is
requesting that loading. The parser at that point is in the
middle of
parsing a document. You definitely cannot reuse it to parse
something
different there. Basically in python except for
identification you must
not try to use it.
Daniel
--
Red Hat Virtualization group http://redhat.com/v
irtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|