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

méchoui laurent.ploix at gmail.com
Tue Jun 17 07:53:50 EDT 2008


On Jun 17, 9:08 am, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> > Yes, I need to make sure my requests are properly written so that the
> > generic XPath engine does not need all the structure in memory.
>
> > There are quite a few cases where you really don't need to load
> > everything at all. /a/b/*/c/d is an example. But even with an example
> > like /x/z[last()]/t, you don't need to load everything under the
> > every /x/z nodes. You just need to check for the latest one, and make
> > sure there is a t node under it.
>
> > Anyway, if I need to make requests that need all the data... that
> > means that the need for lazy instantiation of nodes disappears,
> > right ?
>
> Yes. And unless you have memory-constraints I have to admit that I
> really doubt that the parsing overhead isn't by far exceeded by the
> network latency.
>
> Diez

Do you know if there is such XPath engine that can be applied to a DOM-
like structure ?

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...



More information about the Python-list mailing list