سؤال

First of all, Sorry if I do mistake in my question. I'm french and not the best in english. I have a problem with a Xquery Match in Soapui. There is an exemple of a Soapui response:

<ns0:Group>
     <ns0:Personne>
        <ns0:idPersonne>111</ns0:idPersonne>
     </ns0:Personne>
     <ns0:Personne>
        <ns0:idPersonne>222</ns0:idPersonne>
     </ns0:Personne>
     <ns0:Personne>
        <ns0:idPersonne>333</ns0:idPersonne>
     </ns0:Personne>
</ns0:Group>

I need to check if the Id of a personne is unique or not. If "111" appears only once, it returns "true" If not, it returns "false". Could you help me?

هل كانت مفيدة؟

المحلول

This should do the trick for you:

count(distinct-values(//ns0:idPersonne)) eq 1

I am not that familiar with Soap UI though, so if you have trouble with namespaces you might also like to try instead:

count(distinct-values(//*:idPersonne)) eq 1
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top