944,142 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 2210
  • ASP.NET RSS
Jun 4th, 2007
0

XML Namespace prefix problem

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rahulrv is offline Offline
1 posts
since Jun 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: A suitable Word Template
Next Thread in ASP.NET Forum Timeline: delete a row in a sql databse





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC