c# - Issue writing XML using TextWriter -


i have tried writing xml using textwriter, i've discovered can't write characters < > ' " & file.

the class wrote follows:

public void write_file(rss r, string filename)//-- rss here class built in other place {     xmlserializer serializer = new xmlserializer(typeof(rss));     textwriter textwriter = new streamwriter(path + filename);//-- path directory path save xml file     serializer.serialize(textwriter, r);     textwriter.close();             } 

can me fix this?

you cannot. c# converts such chars:

< &lt;  > &gt; & &amp; 

if allowed, destroy xml. if need add tags, cannot use serializer. need build document using code example form xmldocument class


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -