XML Namespace prefix problem

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2007
Posts: 1
Reputation: rahulrv is an unknown quantity at this point 
Solved Threads: 0
rahulrv rahulrv is offline Offline
Newbie Poster

XML Namespace prefix problem

 
0
  #1
Jun 4th, 2007
Hi,
I have an xml which looks like this:
<Events>
<Event xmlns="http://abc.com">
<System>
<Name ="abc" />
</System>
<Manager>
<Name ="abc1" />
</System>
</Event>
</Events>
I use the following code to obtain the System node and it fails
XmlDocument document = new XmlDocument();
document.Load("c:\\results.xml");
XmlNodeList tmp1 = document.GetElementsByTagName("Event");
foreach (XmlNode k in tmp1)
{
XmlNode a = k.SelectSingleNode("System");
<<---------- a always returns NULL-------------->>
<< if I add a prefix to the URI, or remove the namespace URI from the results.xml, then it works, however, this is the XML i need to parse, any ideas. >>
if (a != null)
What am I doing wrong?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC