Querying attribute of an element using ~= instead of =


if I have the following XML in my db

San Francisco

San Jose

I know I can run the following x-query

property[location/city=‘San Francisco’]



I can also run


however, I CAN’T seem to run


Is this not possible? Can ~= be used for elements and not their attributes?

Any help would be appreciated.


~=‘Apartment’ will look for the individual word ‘Apartment’ in the string. The string ‘4-Room-Apartment’ does not contain this, the use of the hyphens is getting in the way. Try ~=’*Apartment’ . This will return documents where the string ENDS in Apartment. Further to this you could use ~=‘Apartment’, which would return all documents where ‘Apartment’ occurs ANYWHERE in the string.

question for you. I am trying to get a hold of the whole querying and i just can’t seem to get started. what is the rest of your code that you use. i look at other examples and you’re is so basic, …query this for this… what language is that and can you guide me?

public static void fillVector(String docType, Vector docVector, String qStrXpath, String qStrValue, String qStrOpr) {
try {
BusinessDocumentWorkspace ws = new BusinessDocumentWorkspace(store);
QueryContainer query = new QueryContainer(docType);
query.add(new QueryElement(qStrXpath, qStrValue, qStrOpr));
Cursor docCursor = ws.query(“qry”+docType, query);
int counter = 0;
while (docCursor.hasNext()) {
BusinessDocument doc = (BusinessDocument)docCursor.next();
System.out.println( docType+ ": " + doc.getDocumentId());
} catch (StoreException e) { e.printStackTrace(); }

this one a simple query code.

But first you should create store and register doctype

public static TaminoStore createStore( String url ) throws StoreException {
tstore = new TaminoStore(url);
return tstore;

url is your database like

protected static void RegisterDocType(String docType,String coll) {

coll is your collection


where do you put the x-query code? which file?