Mega Code Archive

 
Categories / C# Tutorial / XML
 

Select Nodes By Namespace

using System; using System.Xml; public class MainClass  {   [STAThread]   private static void Main()   {     XmlDocument doc = new XmlDocument();     doc.Load("Sample.xml");     XmlNodeList matches = doc.GetElementsByTagName("*", "http://mycompany/OrderML");     foreach (XmlNode node in matches)     {       Console.WriteLine(node.Name );       foreach (XmlAttribute attribute in node.Attributes)       {         Console.WriteLine(attribute.Value);       }     }   } }