try {
Element rolesElem = doc.createElement(ROLES);
rootElem.appendChild(rolesElem);
AccessUtils utils = new AccessUtils(col.getDatabase());
Access access = utils.readAccess(col.getCanonicalName());
String[] roles = access.listRoles();
for ( int i = 0; i < roles.length; i++ ) {
Element roleElem = doc.createElement(ROLE);
roleElem.appendChild(doc.createTextNode(roles[i]));
rolesElem.appendChild(roleElem);
Role role = utils.readRole(roles[i]);
int permissions = access.getPermissions(role);
if ( permissions != 0 ) {
StringBuffer sb = new StringBuffer();
for ( int j = 0; j < STRS.length; j++ )
if ( (permissions & INTS[j]) != 0 )
sb.append(STRS[j]);