Select Nodes By Namespace : Xml Namespace « XML « C# / CSharp Tutorial






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);
      }
    }
  }
}








30.15.Xml Namespace
30.15.1.Select Nodes By Namespace
30.15.2.Get Namespace URI, Prefix and LocalName