Ahh I think I figured out my own answer.... duh.
I need to get the collection("foo") and then do
colFoo.getService()
and then add the
new collection.
I will try this.
----- Original Message -----
From: "Kurt Kavanaugh" <[EMAIL PROTECTED]>
To: "Xindice users (E-mail)" <[email protected]>
Sent: Friday, October 24, 2003 5:16 PM
Subject: Creating a nested collection
How?
Here is what I am doing....
CollectionManagementService service = (CollectionManagementService)
colRoot.getService("CollectionManager", "1.0");
String sCollectionName = "foo";
String sNestedName = sCollectionName + "/" + "bar";
service.createCollection(sCollectionName);
// works fine
service.createCollection(sNestedName);
// fails
The interesting thing to note is.... Code snipped from Xindice
CollectionImpl.java
/* see superclass for documentation */
public org.xmldb.api.base.Collection createCollection(String name,
Document configuration) throws XMLDBException {
checkOpen();
try {
Configuration config = new
Configuration(configuration.getDocumentElement(), false);
col.createCollection(name, config);
return getChildCollection(name);
} catch (Exception e) {
throw
FaultCodes.createXMLDBException(ErrorCodes.INVALID_COLLECTION,
FaultCodes.GEN_UNKNOWN,
"Cannot create child
collection", e);
}
}
That it gets all the way through the col.createCollection( name, config );
but fails in the getCollectionName()....
public org.xmldb.api.base.Collection getChildCollection(String name)
throws XMLDBException {
if (name.indexOf('/') != -1) {
throw new XMLDBException(ErrorCodes.INVALID_COLLECTION,
"Invalid collection: " + name);
}
Because it contains a "/" is this intended?