How to request data from a lazily-created tree structure ?

méchoui laurent.ploix at gmail.com
Fri Jun 20 22:15:37 CEST 2008


On Jun 17, 10:54 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> > Do you know if there is such XPath engine that can be applied to a DOM-
> > like structure ?
>
> No. But I toyed with the idea to write one :)
>
> > One way would be to take an XPath engine from an existing XML engine
> > (ElementTree, or any other), and see what APIs it calls... and see if
> > we cannot create a DOM-like structure that has the same API. Duck
> > typing, really...
>
> Why can't you create a *real* DOM?
>
> Diez

I don't know what "real" means, in fact. In python, being a "real" sg
is all about having the same interface, right? May be I did not
undertand what you meant.

I cannot load all the data in memory before I request it, because it
would take too long. If using XPath-like tools requires that I load
the data in memory, I'd better create my own algorithm instead. It
will be much faster.

What I mean it: if I have a XPath engine that works well on a specific
DOM-like structure... may be I can create my own DOM-lile structure to
fool the XPath engine; so that I can use it on my own structure.



More information about the Python-list mailing list