}
else {
result = col.queryCollection(queryLang, query, namespaces);
}
ResourceSetImpl rs = new ResourceSetImpl(this, null);
while (result.hasMoreNodes()) {
Node n = result.getNextNode();
if ( n instanceof DBNode ) {
( ( DBNode ) n ).expandSource();
}
String documentId = ((Element) n).getAttributeNS(QUERY_NS, "key");
XMLResourceImpl resource = new XMLResourceImpl(null, documentId, this,
TextWriter.toString( n ));
rs.addResource(resource);
}
return rs;
} catch (Exception e) {
throw FaultCodes.createXMLDBException(FaultCodes.QRY_PROCESSING_ERROR, "Query error", e);