•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 397,850 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,324 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 944 | Replies: 0
![]() |
•
•
Join Date: Jun 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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?
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?
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
.net .net framework 3.0 access ajax api asp blogger blogging code combo custom data developer development dom dropdownlist feed gdata google html linspire linux microsoft module msdn net news office openoffice programming reader reuse rss skin software sql standards theme vista w3c weather web windows workflow xml xoap
- XML data to database (RSS, Web Services and SOAP)
- VB.NET Error (ASP.NET)
- Problem when handling with processes! (C)
- xsl-fo (DaniWeb Community Feedback)
- getattr function (Python)
- Regular Expression Matching New Line (Perl)
- Brain Dead Night (C++)
Other Threads in the ASP.NET Forum
- Previous Thread: A suitable Word Template
- Next Thread: delete a row in a sql databse


Linear Mode