Mega Code Archive

 
Categories / C# / XML
 

Convert String To XmlReader

//http://validationframework.codeplex.com/ //License:  Microsoft Permissive License (Ms-PL) v1.1   using System; using System.Globalization; using System.IO; using System.Text; using System.Xml; namespace ValidationFramework.Extensions {     /// <summary>     /// String helper methods     /// </summary>   public static class StringExtensions   {        internal static XmlReader ToXmlReader(this string value)         {             var settings = new XmlReaderSettings { ConformanceLevel = ConformanceLevel.Fragment, IgnoreWhitespace = true, IgnoreComments = true };             var xmlReader = XmlReader.Create(new StringReader(value), settings);             xmlReader.Read();             return xmlReader;         }    } }