473,324 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

C#, Application, Problem with XML URI Prefix

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?

Thanks,
Rahul.
Jun 5 '07 #1
1 1213
Rahul,

i cant understand wy do u use foreach to get the System node
Instead try using for loop iterating thru the nodelist

try the following

for(int i=0;i<tmp1.count,i++)
{
XmlNode a = tmp1[i].SelectSingleNode("System");

}

now u get the system node in the XmlNode a

hope this reply helps

revert back if u hav any more queries

cheers
nandhu
Jun 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Ling Lee | last post by:
Hello. I'm trying to write a small program that lets you put in a number as an integer and then it tells you the textuel representation of the number. Like if your input is 42, it will say...
4
by: Chefry | last post by:
I'm trying to set up an off the shelf script and keep getting an error. My host set up the mysql on my site and I changed the variables I had to in the settings.php file but I keep getting the...
8
by: Lawrence Oluyede | last post by:
Is there a way to treat html tags like simple text? I explain myself, if I have a bunch of xml like <content type="application/xhtml+xml" xml:base="http://loluyede.blogspot.com" xml:lang="en-US"...
6
by: eXseraph | last post by:
Hi, As we know,in normal asp.net application, a browser need to send a request to a server first to refresh its page. Now I need to design a asp.net application with real-time capability like the...
3
by: Yair Cohen | last post by:
hello 1 i use an xml documet with xml schema but when i try to use XPath (selectnodes) it retrieves empty list. when i remove the schema (the 'xmlns="http..."') i get the data. how can i handle...
25
by: Dan Stromberg | last post by:
Hi folks. Python appears to have a good sort method, but when sorting array elements that are very large, and hence have very expensive compares, is there some sort of already-available sort...
18
by: jacksu | last post by:
I have a simple program to run xpath with xerces 1_2_7 XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); XPathExpression xp = xPath.compile(strXpr);...
3
by: Chris | last post by:
Hi everyone, I'm trying to parse through the contents of some text files with regular expressions, but am new to regular expressions and how to use them in VB.net. I'm pretty sure that the...
1
by: untitled | last post by:
i wrote an application in c++ that capture a motion from a bmp sequence and outputs a 3DS max secript file contains the motions keys. i have two points here need to be fixed: 1- it is an offline...
23
by: Allan Ebdrup | last post by:
I hava an ajax web application where i hvae problems with UTF-8 encoding oc chineese chars. My Ajax webapplication runs in a HTML page that is UTF-8 Encoded. I copy and paste some chineese chars...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.