XML.ignoreProcessingInstructions = false; var xml = Some text here ; var xmlString = xml.toXMLString();