builder.addAttribute(new QName("owner"), permission.getOwner().getName());
builder.addAttribute(new QName("group"), permission.getGroup().getName());
builder.addAttribute(new QName("mode"), permission.toString());
if(permission instanceof SimpleACLPermission) {
final SimpleACLPermission aclPermission = (SimpleACLPermission)permission;
builder.startElement(new QName("acl", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX), null);
builder.addAttribute(new QName("entries"), String.valueOf(aclPermission.getACECount()));
for(int i = 0; i < aclPermission.getACECount(); i++) {
builder.startElement(new QName("ace", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX), null);
builder.addAttribute(new QName("index"), String.valueOf(i));
builder.addAttribute(new QName("target"), aclPermission.getACETarget(i).name());
builder.addAttribute(new QName("who"), aclPermission.getACEWho(i));
builder.addAttribute(new QName("access_type"), aclPermission.getACEAccessType(i).name());
builder.addAttribute(new QName("mode"), aclPermission.getACEModeString(i));
builder.endElement();
}
builder.endElement();
}