I write XMl and want its structure as following
<videos>
<video>
<type comment="xxxxxxxx"> test </type>
<video>
</videos>
I tried
XmlTextWriter writer = new XmlTextWriter("C:\\tes.xml");
writer.Formatting = Formatting.Indented;
writer.Indentation = 3;
writer.WriteStartDocument();
writer.WriteStartElement("Videos");
writer.WriteStartElement("video");
writer.WriteElementString("type", "test");
writer.WriteAttributeString("comment", "xxxxxxxx");
writer.WriteEndElement();
but writer.WriteAttributeString("comment", "xxxxxxxx"); doesn't work ,any idea how to insert comment attribute to type