XQuery in Java

I have some problems about querying xml data from java…When I use Tamino interactive interface I can do what I want but I couldnt find the way to do same in java. here is the xml file I query:

<ino:request xmlns:ino=“http://namespaces.softwareag.com/tamino/response2”>
<ino:object ino:docname=“similarity_table.xml”>











</ino:object >
</ino:request>

the query I use in interactive interface is(it works fine):
for $b in input()/SimilarityTable/cell
where $b/@age1 = “old” and $b/@age2 =“old”
return $b/@similarity_value

I used this in java but didnt work:
String c = “old”;
TQuery queryall = TQuery.newInstance(“SimilarityTable”+“[cell/@age1 = "”+ c +
“" and cell/@age2 = "”+ c + “"]” );

How can I write complex queries with XQuery in java? Thanx:)

Hi ekin,

You can try using the TXQuery in Tamino Java API which allows you to execute your xquery as it is :

for $b in input()/SimilarityTable/cell
where $b/@age1 = “old” and $b/@age2 =“old”
return $b/@similarity_value

Do note that TQuery is for xpath query only. Hope this helps. :slight_smile:

It does, thanks a lot:)