Clean chunk Java code

Add convenience methods for writing XML and remove CDATA generation.