Re: [xml] XPath performance



On Sun, Nov 05, 2006 at 10:22:46AM +0100, Karel Michek wrote:
Hi,
When accessing XML tree that has structure outlined bellow and which
contains hundreds of thousands of "doc" nodes and using something like

xmlXPathEvalExpression(/job/doc[100000]/page/meta/meta_type/meta1, xpathCtx);

the performance is not acceptable. I wander if there is any way to

  the siblings are stored in a doubly linked list. There is no array or 
database index on name tag, sorry there is no way to avoid walking up the
full sibling list in libxml2.

 <doc id="1">
<doc id="2">

id('100000')/page/meta/meta_type/meta1 may work if the id attribute was defined
as an XML ID. Using xml:id would do that automatically without DTD.
In XSLT defining doc/@id as a key would also allow to index and have an instant
lookup.

  Those are really basic XML and XSLT solution design, and not specifically
dependant on libxml2, nothing replace learning about the technology in question.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
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/



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