Convert Javascript code to an XML document