public async Task WriteXhtmlFragmentAsync(StringWriter writer, ContentURI uri, string xmlDocToReadPath, DataHelpers.GeneralHelpers.DOC_STATE_NUMBER displayDocType) { XmlReader oReader = null; if (DataHelpers.FileStorageIO.URIAbsoluteExists(uri, xmlDocToReadPath)) { oReader = DataHelpers.FileStorageIO.GetXmlReader(uri, xmlDocToReadPath); } else { SetNoXmlDocErrorMsg(uri, displayDocType); } if (oReader != null) { using (oReader) { if (uri.URIDataManager.ServerSubActionType != DataHelpers.GeneralHelpers.SERVER_SUBACTION_TYPES.respondwithxml && Path.GetExtension(xmlDocToReadPath).EndsWith( DataAppHelpers.Resources.GENERAL_RESOURCE_TYPES.xml.ToString())) { //write the transformed xml doc (ChangeDisplayParams switched apps so that servicespacks display correctly) StylesheetHelper styleHelper = new StylesheetHelper(); await styleHelper.TransformXmlToXhtmlAsync(writer, uri, displayDocType, oReader); } else { oReader.MoveToContent(); writer.Write(oReader.ReadOuterXml()); } oReader.Close(); } } }