Convert String To XmlReader

image_pdfimage_print
   
 
//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;
        }
   }
}

   
     


This entry was posted in XML-RPC. Bookmark the permalink.