Re: [xml] Beginner's question about xPath



On Wed, 2005-06-29 at 15:39 -0400, ABeylin axsone com wrote:

I cannot figure out how to use xPath without loading the entire XML into
memory.

This is an implementation-specific question, and for libxml2 the answer
is usually that you will need the whole document in memory.

If this is a problem (e.g. very large documents) there are other
approaches, especially with XPath 2.0 -- XSLT 2.0 and XQuery which both
use XPath 2.0 can operate over indexed collections of documents,
although there are not yet many implementations of that feature, and
none I think using libxml2.

The problem is that XPath expressions can easily be written that rely
on the entire document, e.g. count(//*) or section[position() = last()]
or using the ancestor axis to navigate around.  A lot of research has
been done on optimising XPath, some of it in the database community,
especially in conjunction with XQuery (www.w3.org/XML/Query).

Hope this helps although it might not be very encouraging!

Liam

-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin
Pictures from old books: http://www.holoweb.net/~liam/pictures/oldbooks/
IRC (chat) programs: www.ircreviews.org/clients/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]