Jsoup is an open source java library for parsing and manipulating HTML with ease.
Get the latest binaries from http://jsoup.org/.
This requires the library jsoup-1.6.1.jar to be in classpath.
The following example shows prepending a tag element to another element.