/** * This will take a DSML <code>Element</code> containing an entry of type <dsml:entry * name="name"/> and convert it to an LDAP entry. * * @param entryElement <code>Element</code> of DSML content * @return <code>LdapEntry</code> */ protected LdapEntry createSearchResult(final Element entryElement) { final LdapEntry ldapEntry = new LdapEntry(); ldapEntry.setDn(""); if (entryElement != null) { final String name = entryElement.attributeValue("dn"); if (name != null) { ldapEntry.setDn(name); } if (entryElement.hasContent()) { final Iterator<?> ocIterator = entryElement.elementIterator("objectclass"); while (ocIterator.hasNext()) { final Element ocElement = (Element) ocIterator.next(); if (ocElement != null && ocElement.hasContent()) { final String ocName = "objectClass"; final LdapAttribute ldapAttribute = new LdapAttribute(ocName); final Iterator<?> valueIterator = ocElement.elementIterator("oc-value"); while (valueIterator.hasNext()) { final Element valueElement = (Element) valueIterator.next(); if (valueElement != null) { final String value = valueElement.getText(); if (value != null) { final String encoding = valueElement.attributeValue("encoding"); if (encoding != null && encoding.equals("base64")) { ldapAttribute.getValues().add(LdapUtil.base64Decode(value)); } else { ldapAttribute.getValues().add(value); } } } } ldapEntry.getLdapAttributes().addAttribute(ldapAttribute); } } ldapEntry .getLdapAttributes() .addAttributes( super.createSearchResult(entryElement).getLdapAttributes().getAttributes()); } } return ldapEntry; }