CHECKING EXISTENCE

I have an xml with Users root element and some nested element like UserID, my desire is to check if an userID exist in these data.
So, if i do the query /Users/UserID=“someuserid” or //UserID=“someuserid” i don’t get an entire xml object and so the check response.hasFirstXMLObject() cannot be done an so i tried with resp.hasQueryContent()but it returns always true indipendently that the specified user is in the xml or not.
Why?
Can anyone help me?

BRGS @nto

Please, try the query
Users[UserID=“someuserid”]
or
Users[./UserID=“someuserid”]
or
Users[//UserID=“someuserid”]

in order to get the complete Users document.

Regards.

It works.
So if i have to select a particular element in a document have i always to structure the query in the way the it will return an entire xml object?
This is the actual Tamino limitation?

ThxS
@nto

No, that is not a Tamino limitation.

With your query: Users/UserID="someuserid"
you are asking Tamino something meaning "Are there any Users document which has a node UserID with value “someuserid”??"

and Tamino answers you:
xql:resultTRUE</xql:result> (or FALSE)

With my queries I am asking Tamino “give me the documents that have the value “someuserid” in the node UserID”.

If you need only to retrieve the UserID node, the correct query is (one of the possibilities):

User[./UserID=“someuserid”]/UserID

More information in Tamino Documentation (X-Query) and the XPath documentation :wink:

Regards.