using System;
using System.Xml;
using System.Xml.XPath;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
XPathNavigator nav;
XPathDocument docNav;
XmlNamespaceManager nsMgr;
// Openning MYXML doc
docNav = new XPathDocument(@"c:\Users\Somebody\Desktop\xml\MYLASTXML.123456.MYXML.xml");
// Creating a navigator to query using XPath.
nav = docNav.CreateNavigator();
//Add Namespaces for scb and conf
nsMgr = new XmlNamespaceManager(nav.NameTable);
nsMgr.AddNamespace("abc", "http://www.ababab.com/MYXML-1");
nsMgr.AddNamespace("conf", "http://www.fpml.org/FpML-5/confirmation");
.... //I should continue add namespaces here but I need a function to populate with all namespaces found in the XML document..... can you help?
nav = docNav.CreateNavigator().SelectSingleNode("/abc:MYXML/blahblahblah/conf:productId[@productIdScheme='http://www.fpml.org/coding-scheme/external/instrument-id']/text()", nsMgr);
Console.WriteLine(nav);
Console.ReadLine();
}
}
}
ASKER
C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).
TRUSTED BY
ASKER