Mega Code Archive

 
Categories / C# / XML
 

Get XML Nodes in a Specific XML Namespace

using System; using System.Xml; public class SelectNodesByNamespace {     private static void Main() {         XmlDocument doc = new XmlDocument();         doc.Load("Order.xml");         XmlNodeList matches = doc.GetElementsByTagName("*","http://mycompany/OrderML");         foreach (XmlNode node in matches) {             Console.Write(node.Name + "\t");             foreach (XmlAttribute attribute in node.Attributes) {                 Console.Write(attribute.Value + "  ");             }         }     } }