Element set = doc.createElementNS(RESOURCE_SET_NS, "xapi:resourceSet");
set.setAttributeNS(RESOURCE_SET_NS, "xapi:collectionURI",
"xmldb:xindice://" + ((XindiceCollection) collection).getCanonicalName());
set.setAttribute("xmlns:xapi", RESOURCE_SET_NS);
doc.appendChild(set);
int i = 0;
while (i < resources.size()) {
XMLResource res = (XMLResource) resources.get(i);
Element resource = doc.createElementNS(RESOURCE_SET_NS,