A couple of small changes to comply with code standards. Also, note that the second param of element() and elementStart() can be a string.
Made a class for outputting XML code