Get XML Nodes in a Specific XML Namespace

image_pdfimage_print
   
  

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 + "	");
            foreach (XmlAttribute attribute in node.Attributes) {
                Console.Write(attribute.Value + "  ");
            }
        }
    }
}

   
     


This entry was posted in XML-RPC. Bookmark the permalink.