[topicmapmail] xpath: stop at first match

Carlo Moneti cmoneti at twcny.rr.com
Mon Jul 31 14:13:08 EDT 2006


On 2006.07.31 12:25 G. Ken Holman wrote:
> Both citations do accommodate XPath questions and issues, which is why 
> I included them.

Yes, but I could not find any mention of the functionality I was looking 
for. So I'm still looking for confirmation.

> I disagree: the XPath expression you have given will only look at 
> 'topic' children element nodes of the document element node, and 
> nowhere else in the node tree.

Agreed. and I wondered if there is an option for the scan to stop at the 
first match.

> And, anyway, XPath addresses a tree of nodes that have been created by 
> the document, so it won't be going back to the document itself looking 
> for anything, only in the nodes of the XPath tree.

Agreed. I didn't mean to suggest otherwise. I'm sorry for not being more 
clear.

> XPath is declarative and the address you have given is addressing *all* 
> topic children with the given id= attribute.
> 
> If you added a second predicate as in:
> 
>   /topicMap/topic[@id='$id'][1]
> 
> this *may* help, but the processor is allowed to access them all and 
> then only return the first.  A processor that implements lazy 
> evaluation *may* stop when it finds the first one, but a processor is 
> not obliged to be implemented in a lazy fashion.

Yep, I guess I would like the option to tell the processor how lazy to 
be. :-)

Thanks again,
Carlo


More information about the topicmapmail mailing list