How can I get Collectionnames?

Hello,

How can I get all Collectionnames that defined in a database? My programm shall give a choice of all available Collections in my database.

Thanks
Sven

You could use a query like this to get the information you need:

http://server/tamino/database/ino:collection?_xql=xs:schema/@ino:docname[not(.~="ino*")]</pre><BR>You can issue this query from the API like any other query. The query will give you a list of elements like this:<pre class="ip-ubbcode-code-pre"><xs:schema ino:id="17" xmlns:xs="http://www.w3.org/2001/XMLSchema" ino:docname="xapplication3.1.3.2/PropCustomer" /> 
  <xs:schema ino:id="18" xmlns:xs="http://www.w3.org/2001/XMLSchema" ino:docname="xapplication3.1.3.2/patient" /> 
  <xs:schema ino:id="19" xmlns:xs="http://www.w3.org/2001/XMLSchema" ino:docname="xapplication3.1.3.2/invoice" />

where the first part of the ino:docname attribute is the Collection and the second part (after the slash) is the Schema name.

The query will ignore internal collections used by Tamino such as ino:vocabulary and ino:collection.

HTH
QueryColl.java (2.27 KB)

If you use the newer “Tamino API for Java”, then there is another way, which might help you with your requirements. There are two methods in the SchemaAccesors, which return all collection with TSD3 or TSD2 Schemas:

Iterator TSchemaDefinition3Accessor.getCollectionNames()
Iterator TSchemaDefinition2Accessor.getCollectionNames()

Both return an Iterator over all collections in the database. As far as I know they return all collections including the internal collections (“ino:…”), but you might want to try this out by yourself.

Similiar methods exists for getting a list of Schema names.

…so here’s a better example. Many thanks.
QueryColl.java (1.66 KB)