@Override
 public void endElement(String name, String elementText) {
   // Owner details.
   if (name.equals("ID") && !insideACL) {
     owner.setId(elementText);
   } else if (name.equals("Name") && !insideACL) {
     owner.setDisplayName(elementText);
   }
   // ACL details.
   else if (name.equals("ID")) {
     currentGrantee.setIdentifier(elementText);
   } else if (name.equals("EmailAddress")) {
     currentGrantee.setIdentifier(elementText);
   } else if (name.equals("URI")) {
     currentGrantee.setIdentifier(elementText);
   } else if (name.equals("Name")) {
     if (currentGrantee instanceof UserByIdGrantee) {
       ((UserByIdGrantee) currentGrantee).setName(elementText);
     } else if (currentGrantee instanceof UserByEmailAddressGrantee) {
       ((UserByEmailAddressGrantee) currentGrantee).setName(elementText);
     } else if (currentGrantee instanceof GroupByIdGrantee) {
       ((GroupByIdGrantee) currentGrantee).setName(elementText);
     } else if (currentGrantee instanceof GroupByEmailAddressGrantee) {
       ((GroupByEmailAddressGrantee) currentGrantee).setName(elementText);
     }
   } else if (name.equals("Permission")) {
     currentPermission = Permission.parsePermission(elementText);
   } else if (name.equals("Entry")) {
     accessControlList.grantPermission(currentGrantee, currentPermission);
   } else if (name.equals("Entries")) {
     insideACL = false;
   }
 }
 public void endElement(String uri, String name, String qName) {
   String elementText = this.currText.toString();
   // Owner details.
   if (name.equals("ID") && !insideACL) {
     owner.setId(elementText);
   } else if (name.equals("DisplayName") && !insideACL) {
     owner.setDisplayName(elementText);
   }
   // ACL details.
   else if (name.equals("ID")) {
     currentGrantee.setIdentifier(elementText);
   } else if (name.equals("EmailAddress")) {
     currentGrantee.setIdentifier(elementText);
   } else if (name.equals("URI")) {
     currentGrantee.setIdentifier(elementText);
   } else if (name.equals("DisplayName")) {
     ((CanonicalGrantee) currentGrantee).setDisplayName(elementText);
   } else if (name.equals("Permission")) {
     currentPermission = Permission.parsePermission(elementText);
   } else if (name.equals("Grant")) {
     accessControlList.grantPermission(currentGrantee, currentPermission);
   } else if (name.equals("AccessControlList")) {
     insideACL = false;
   }
   this.currText = new StringBuffer();
 }