How far have you gotten on this problem? Have you studied the javax.crypto package JavaDocs? Searched for code examples using google?
The most important point is that XML is a text format and must contain only legal unicode characters, while the initial result of encryption will be a byte[]. Therefore, your encrypted byte[] must be encoded to legal characters - base64 encoding is typically used.
The
Apache commons codec toolkit is an open source for base64 encoding classes.
Bill