topical media & game development

talk show tell print

professional-xml-15-Listing-15-18.txt / txt



  using System;
  using System.Collections.Generic;
  using System.Text;
  using System.Xml;
  using System.Xml.XPath;
  using System.IO;
  
  namespace XmlProject
  {
      class Program
      {
          static void Main(string[] args)        
          {
              try
              {                
                  FileStream myStockOrders = new 
                     FileStream("C:/MyXml.xml", FileMode.Open);
                  
                  XPathDocument myDocument = new XPathDocument(myStockOrders);
                  XPathNavigator docNavigation = myDocument.CreateNavigator();
  
                  foreach(XPathNavigator node in 
                      docNavigation.Select
                      ("//MultiStockOrder/StockOrderMultiple/StockOrder/Symbol"))
                  {
                      Console.WriteLine(node.Value.ToString());
                  }
  
                  Console.WriteLine("Done");
                  Console.ReadLine();
              }
              catch (System.Exception ex)
              {
                  Console.Error.WriteLine(ex.ToString());
                  Console.ReadLine();
              }
          }
      }
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.