I’m curious how often someone has written the equivalent of this. I wonder why there isn’t just some tool, and yes, I’ve used xmllint shell to do the same thing.
1 using System; 2 using System.Xml; 3 4 public class Program { 5 public static int Main(string[] args) { 6 var doc = new XmlDocument(); 7 doc.Load(args[0]); 8 foreach (XmlElement n in doc.SelectNodes(args[1])) { 9 Console.WriteLine(n.InnerXml); 10 } 11 return 0; 12 } 13 }