// Modifications
List<ModificationItemImpl> modifications = request.getModifications();
for ( int i = 0; i < modifications.size(); i++ )
{
ModificationItemImpl modificationItem = modifications.get( i );
Element modElement = element.addElement( "modification" );
if ( modificationItem.getAttribute() != null )
{
modElement.addAttribute( "name", modificationItem.getAttribute().getID() );
try
{
NamingEnumeration ne = modificationItem.getAttribute().getAll();
while ( ne.hasMoreElements() )
{
Object value = ( Object ) ne.nextElement();
if ( value != null )
{
if ( ParserUtils.needsBase64Encoding( value ) )
{
Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI );
Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI );
element.getDocument().getRootElement().add( xsdNamespace );
element.getDocument().getRootElement().add( xsiNamespace );
Element valueElement = modElement.addElement( "value" ).addText( ParserUtils.base64Encode( value ) );
valueElement
.addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY );
}
else
{
modElement.addElement( "value" ).setText( (String) value );
}
}
}
}
catch ( NamingException e )
{
}
}
int operation = modificationItem.getModificationOp();
if ( operation == DirContext.ADD_ATTRIBUTE )
{
modElement.addAttribute( "operation", "add" );
}
else if ( operation == DirContext.REPLACE_ATTRIBUTE )