See my thread on Jolene. The document objects that Jolene creates when parsing an HTML file can also be used on their own.
example:
Image img = new Image();
img.setAttribute("src", "/img/smile.png");
img.setAttribute("alt", "Smile");
img.setAfterText("Click me!");
button.setContent(img);
button.setValue("Click");
Which would output (using toString):
<button name="MyButton" value="Click"><img alt="Smile" src="/img/smile.png">Click me!</button>
http://jolene.sourceforge.net/