473,322 Members | 1,718 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,322 software developers and data experts.

SelectNodes does not contain all nodes continued

I wasn't ready...
I have this XML:

<section name="11">
<department department_id="10">
<employee employment_id="24" contract="125"/>
<employee employment_id="5054" contract_id="11184"/>
<employee employment_id="5253" contract_id="11493"/>
<employee employment_id="5253" contract_id="11494"/>
<employee employment_id="5253" contract_id="11495">
<employee employment_id="248" contract_id="1418"/>
</department>
</section>

If I use this code,

For Each node As XmlNode In mStaff.MatrikelXML.SelectNodes("//employee")
Console.WriteLine(node.Attributes.GetNamedItem("em ployment_id").Value)
Console.WriteLine(node.Attributes.GetNamedItem("co ntract_id").Value)
Next

I get this result:
24 125
5054 11184
5253 11493
248 1418

I want:
24 125
5054 11184
5253 11493
5253 11494
5253 11495
248 1418

Can someone please explain to me why this happens?
/frass

User submitted from AEWNET (http://www.aewnet.com/)
Nov 12 '05 #1
1 1337
*sigh*
forget it...
I wasn't ready...
I have this XML:

<section name="11">
<department department_id="10">
<employee employment_id="24" contract="125"/>
<employee employment_id="5054" contract_id="11184"/>
<employee employment_id="5253" contract_id="11493"/>
<employee employment_id="5253" contract_id="11494"/>
<employee employment_id="5253" contract_id="11495">
<employee employment_id="248" contract_id="1418"/>
</department>
</section>

If I use this code,

For Each node As XmlNode In mStaff.MatrikelXML.SelectNodes("//employee")
Console.WriteLine(node.Attributes.GetNamedItem("em ployment_id").Value)
Console.WriteLine(node.Attributes.GetNamedItem("co ntract_id").Value)
Next

I get this result:
24 125
5054 11184
5253 11493
248 1418

I want:
24 125
5054 11184
5253 11493
5253 11494
5253 11495
248 1418

Can someone please explain to me why this happens?
/frasse

User submitted from AEWNET (http://www.aewnet.com/


User submitted from AEWNET (http://www.aewnet.com/)
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Alexander Gnauck | last post by:
Hello, i have problems with the Namespaces and the .Net XML Parser My XML looks like this: <query xmlns="jabber:iq:roster"> <item jid="srlee@localhost" name="srlee"...
4
by: Andrew Parsons | last post by:
Hey all, I have the following code to get a set of nodes containing a certain search criteria: theSearchTermsXML.selectNodes("/Table/Row/Cell") This works fine to a point - it finds all...
0
by: Guest | last post by:
Hi, I have this XML: <section name="11"> <department department_id="10"> <employee employment_id="24" contract="100"/> <employee employment_id="5054" contract_id="254"/> <employee...
2
by: Michael H | last post by:
Hello group, I have a some xml that looks like this below: <tuneRequests ct="3" xmlns:sql="urn:schemas-microsoft-com:xml-sql" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <tr...
2
by: Joe | last post by:
Hello All: Does anyone know the differnce between the GetElementsByTagName method and the SelectNodes method? I know that they take different arguments. They also both return a NodeList. I'm...
16
by: PiotrKolodziej | last post by:
Hi I'am using SelectNodes method to find if node followed by string exists, and if so i going to select that node. Create doc i such a way: doc = new XmlDocument(); ...
1
by: RKS | last post by:
Has anyone experienced a problem with the Sarissa implementation of selectNodes? My code, using the Sarissa parser, successfully loads an xml document into the domNode variable. The selectNodes...
3
by: Woon Kiat | last post by:
I have this Xml file, bookstore.xml <Bookstore xmlns="http://www.book.com"> <Shelve index="1"> <Book name="Da Vinci Code" /> </Shelve> <Shelve index="2"> <Book name="The Holy Grail" />...
8
by: Vikram Vamshi | last post by:
If I execute XmlNode.SelectNodes("some xpath query") and then use foreach to iterate over it. Will it guaratee that the order of nodes I get will be same as the order of nodes in the original xml...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.