// 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.RegularExpressions; namespace E { class MainClass { public static void Main(string[] args) { StreamReader sr = new StreamReader(@"C:\snask.xml"); string s = sr.ReadToEnd(); string s2 = s; MatchCollection res = Regex.Matches(s,"(?:)(.*?)(?:)", RegexOptions.Singleline); for(int i = 0; i < res.Count; i++) { s2 = s2.Replace(res[i].Groups[1].Value,res[i].Groups[1].Value.Replace("<","<").Replace(">",">")); } StreamWriter sw = new StreamWriter(@"C:\snask2.xml"); sw.Write(s2); sw.Close(); } } }