Thread: XPath to search for elements in a sequence

XPath to search for elements in a sequence

From
Brad Balmer
Date:
With XML similar to:

<a>
 
<b>
 
<c>1</c>
 
<c>2</c>
 
<c>3</c>
</b>

I'm trying to create an xpath expression (for a postgresql query) that will return if is a particular value and not that is all three values.

What I currently have (which does not work) is:

select * from someTable where xpath ('//uim:a/text()', job, ARRAY[ ARRAY['uim','http://www.cmpy.com/uim'] ])::text[] IN (ARRAY['1','3']);


If I try with ARRAY['1'] this will not return any values but with ARRAY['1','2','3'] it will return all three.


How can I select based on a single element in a sequence?


Thanks.