Re: [xml] (python) entity loader issue



On Fri, Apr 07, 2006 at 11:56:18PM +0100, Nic wrote:
I'm in a situation where I'm doing some processing on XSLT documents
when they are loaded and I'm having a lot of trouble doing this
efficiently.

What I have right now is a python entity loader which:

- reads in the associated document
- parses it in memory
- processes the XSLT
- caches the dom for later


Because I'm loading the document and parsing it myself I tried (for a
while) to have the entity loader pass back the document itself.

But that didn't work.

So now I have the entity loader return an open python file handle.

Clearly that is going to mean that libxml2 duplicates my effort by
parsing the document again.

  By definition an entity is a sequence of bytes. Doing XSLT processing
at that level forces a serialization. Remember that the parsing of an
entity can be dependant of the context (e.g. if you parse part of the
external subset, this will be directly dependant on existing defined
entities), so there is no way to avoid that reparsing in general.

Daniel

-- 
Daniel Veillard      | Red Hat http://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]