At least in two major ways:
a) With a good use of regular expressions, thus directly manipulating strings.
b) With a specialized library like jsoup (or others).