/// <summary> /// Converts a string to an XmlReader. /// </summary> /// <param name="input">The input.</param> /// <param name="isInteractive">if set to <c>true</c> the reader will be in an interactive state.</param> /// <returns>An XmlReader</returns> public static XmlReader AsXmlReader(this string input, bool isInteractive) { Contract.Requires(!String.IsNullOrEmpty(input)); Contract.Ensures(Contract.Result<XmlReader>() != null); var reader = input.AsXmlReader(); if (isInteractive) { reader.MoveToContent(); } return reader; }
/// <summary> /// Loads the stream into an xsl document and disposes of the stream. /// </summary> /// <param name="self">The stream being acted on.</param> /// <returns>Returns an xsl document with the stram loaded.</returns> public static XslCompiledTransform AsXslDocument(this Stream self) { using (self) { XslCompiledTransform xsl = new XslCompiledTransform(true); xsl.Load(self.AsXmlReader()); return xsl; } }