Modified the code to handle the XML,XHTML,JSON,PDF,WORD,EXCEL,TEXT_PLAIN and TEXT_CSV MIMETypes. Replaced hardcoded MIMETYPE_XML with dynamic mime type by identifying the type of contents.