views:

127

answers:

1

With xml like:

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

A: 

If you're asking how to get the value of a 1 or more XML elements within your XML segment the easiest way is likely to simply utilize a custom SQL CLR library and XPath analysis from within it to assemble and return whatever information you desire. At least that would be my approach.

Hardryv