// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.IO; using System.Text; using System.Xml; using ICSharpCode.SharpZipLib.Zip; class MainClass { public static void Main(string[] args) { XmlDocument doc = new XmlDocument(); XmlNode root = doc.CreateElement("all"); doc.AppendChild(root); for(int i = 0; i < 5; i++) { XmlNode elm = doc.CreateElement("one"); elm.AppendChild(doc.CreateTextNode("Element #" + (i + 1))); root.AppendChild(elm); } ZipOutputStream zos = new ZipOutputStream(new FileStream(@"C:\Test.zip", FileMode.Create)); ZipEntry ze = new ZipEntry("Test.xml"); zos.PutNextEntry(ze); doc.Save(zos); zos.Finish(); zos.Close(); } }