You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Kurt Kavanaugh <kk...@teletrol.com> on 2003/10/24 23:16:41 UTC
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?
Re: Creating a nested collection
Posted by Kurt <ku...@comcast.net>.
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" <kk...@teletrol.com>
To: "Xindice users (E-mail)" <xi...@xml.apache.org>
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?