You can ask root collection db to list its child collections. Then just
print them out.
Here is a small code example:
public static void printCollections() throws Exception
{
Class c =
Class.forName("org.apache.xindice.client.xmldb.DatabaseImpl");
Database database = (Database)c.newInstance();
DatabaseManager.registerDatabase(database);
Collection col = DatabaseManager.getCollection(
"xmldb:xindice://localhost:8080/db");
Stack s = new Stack();
s.push(col);
while(!s.empty())
{
Collection current = (Collection)s.pop();
System.err.println(current.getName());
// list the collections..
String subCollections[] = col.listChildCollections();
for (int i = 0; i < subCollections.length; i++)
{
Collection child = current.getChildCollection(subCollections[i]);
// some of the sub meta collections where null on my setup.
if(child != null)
{
s.push(child);
}
}
}
}
Todd
Marcin Goldyn wrote:
is there any possibility to get Collections tree from Xindice database??
Marcin Goldyn