CreateDictionaryWriter() public static method

public static CreateDictionaryWriter ( System writer ) : System.Xml.XmlDictionaryWriter
writer System
return System.Xml.XmlDictionaryWriter
Example #1
0
        static public XmlDictionaryWriter CreateTextWriter(Stream stream, Encoding encoding, bool ownsStream)
        {
            XmlWriterSettings settings = new XmlWriterSettings();

            if (s_UTF8Encoding.WebName == encoding.WebName)
            {
                settings.Encoding = s_UTF8Encoding;
            }
            else
            {
                settings.Encoding = encoding;
            }

            settings.CloseOutput        = ownsStream;
            settings.NewLineHandling    = NewLineHandling.Entitize;
            settings.OmitXmlDeclaration = true;
            settings.CheckCharacters    = false;
            return(XmlDictionaryWriter.CreateDictionaryWriter(XmlWriter.Create(stream, settings)));
        }
Example #2
0
        static public XmlDictionaryWriter CreateTextWriter(Stream stream, Encoding encoding, bool ownsStream)
        {
#if NET_NATIVE || MERGE_DCJS
            XmlUTF8TextWriter writer = new XmlUTF8TextWriter();
            writer.SetOutput(stream, encoding, ownsStream);
            return(writer);
#else
            XmlWriterSettings settings = new XmlWriterSettings();
            if (s_UTF8Encoding.WebName == encoding.WebName)
            {
                settings.Encoding = s_UTF8Encoding;
            }
            else
            {
                settings.Encoding = encoding;
            }

            settings.CloseOutput        = ownsStream;
            settings.NewLineHandling    = NewLineHandling.Entitize;
            settings.OmitXmlDeclaration = true;
            settings.CheckCharacters    = false;
            return(XmlDictionaryWriter.CreateDictionaryWriter(XmlWriter.Create(stream, settings)));
#endif
        }