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 getting the first and last child of an element.