usingSystem;usingSystem.Xml;usingSystem.IO;usingSystem.Text;classMainClass{privatestaticvoidMain(){filestreamfs=newFileStream("products.xml",FileMode.Create);XMLwriterw=XmlWriter.Create(fs);w.WriteStartDocument();w.WriteStartElement("products");w.WriteStartElement("product");w.WriteAttributeString("id","1001");w.WriteElementString("productName","gourmetCoffee");w.WriteElementString("productPrice","0.99");w.WriteEndElement();w.WriteStartElement("product");w.WriteAttributeString("id","1002");w.WriteElementString("productName","BlueChinaTeaPot");w.WriteElementString("productPrice","102.99");w.WriteEndElement();w.WriteEndElement();w.WriteEndDocument();w.Flush();fs.Close();fs=newFileStream("products.xml",FileMode.Open);XmlReaderr=XmlReader.Create(fs);while(r.Read()){if(r.NodeType==XmlNodeType.Element){Console.WriteLine("<"+r.Name+">");if(r.HasAttributes){for(inti=0;i<r.AttributeCount;i++){Console.WriteLine("\tATTRIBUTE:"+r.GetAttribute(i));}}}elseif(r.NodeType==XmlNodeType.Text){Console.WriteLine("\tVALUE:"+r.Value);}}}}