c# - Xml generated with fields & attributes entered by webform -


i have following problem! need generate xml document in asp.net. this, need enter following information: - number of tags. - name of each tags (example: , , , etc). - attributes of each tag (example: alex... etc)..

i have function received list (taglist) name of xml tags.

public  void functionxml() {     string rutasave             = string.format(@"c:\xml.xml");     var serializer              = new xmlserializer(typeof(list<string>));     textwriter textwriter       = new streamwriter(rutasave);     serializer.serialize(textwriter, tagslist); } 

but xml generated function looks this:

   <?xml version="1.0" encoding="utf-8"?> <dictionary>   <item>     <key>       <string>campo1</string>     </key>     <value>       <anytype xmlns:q1="http://www.w3.org/2001/xmlschema" d4p1:type="q1:string" xmlns:d4p1="http://www.w3.org/2001/xmlschema-instance">test</anytype>     </value>   </item>   <item>     <key>       <string>campo2</string>     </key>     <value>       <anytype xmlns:q1="http://www.w3.org/2001/xmlschema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/xmlschema-instance">2</anytype>     </value>   </item> </dictionary> 

please, welcome! in advance.

you should use xmlwriter instead of xmlserializer. xmlserializer tries produce xml file object; kind of serialization. more binaryserializer produces xml format instead of byte arrays or streams. xmlwriter class writes hierarchy xml file.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -