473,406 Members | 2,371 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,406 software developers and data experts.

Stuck Trying To Get Elements

I am trying to walk through all the elements in each occurance of a selected
node but I cannot seem to find the correct syntax to use. A simplified copy
of the XML data is shown at the bottom of this post. I want to get a node
list for every occurance of <CGShows> and then step through the child nodes
for each of those occurances. I am trying code like this:
Dim ShowElements As XmlNodeList

ShowElements = xmldoc.SelectNodes("/NewDataSet/CGShows/")

but it doesn't return a node list. I tried changing it to ShowElements =
xmldoc.SelectNodes("/NewDataSet/CGShows/*") but that seems to return all the
child elements

How can I accomplish this?

========== Sample XML ===========
<?xml version = "1.0"?>
<NewDataSet>
<CGShows>
<RegionalID>Boston</RegionalID>
<SeqNbr>1</SeqNbr>
<ShowName>Boston IA Prelims</ShowName>
<ShowDate>2005-02-05T00:00:00.0000000-07:00</ShowDate>
<Type>SC</Type>
<PorF>P</PorF>
<RoundNbr>0</RoundNbr>
<Eqp1Judge>ADAMO S</Eqp1Judge>
<Mov1Judge>ADAMS R</Mov1Judge>
<Ens1Judge>O'MELIA K</Ens1Judge>
<GE1Judge>ANDERSON M</GE1Judge>
<GE2Judge>CASTEEN D</GE2Judge>
<TaPJudge>CONNELL R</TaPJudge>
<PerfSched>
<RegionalID>Boston</RegionalID>
<SeqNbr>1</SeqNbr>
<PerfTime>2005-02-05T09:00:00.0000000-07:00</PerfTime>
<UnitID>2104</UnitID>
<Nickname>All Saints</Nickname>
<Class>IA</Class>
</PerfSched>
<PerfSched>
<RegionalID>Boston</RegionalID>
<SeqNbr>1</SeqNbr>
<PerfTime>2005-02-05T09:08:00.0000000-07:00</PerfTime>
<UnitID>2123</UnitID>
<Nickname>Phantom Brig. </Nickname>
<Class>IA</Class>
</PerfSched>
</CGShows>
<CGShows>
<RegionalID>Boston</RegionalID>
<SeqNbr>2</SeqNbr>
<ShowName>Open Prelims</ShowName>
...... etc ........
</CGShows>
</NewDataSet>
Nov 12 '05 #1
1 1214
I finally took another approach. I set the nodelist to all the children of
<NewDataSet> (which gives me all the <CGShow> elements and worked from that
list. Seems to do what I need.

Wayne

"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I am trying to walk through all the elements in each occurance of a selected node but I cannot seem to find the correct syntax to use. A simplified copy of the XML data is shown at the bottom of this post. I want to get a node
list for every occurance of <CGShows> and then step through the child nodes for each of those occurances. I am trying code like this:
Dim ShowElements As XmlNodeList

ShowElements = xmldoc.SelectNodes("/NewDataSet/CGShows/")

but it doesn't return a node list. I tried changing it to ShowElements =
xmldoc.SelectNodes("/NewDataSet/CGShows/*") but that seems to return all the child elements

How can I accomplish this?

========== Sample XML ===========
<?xml version = "1.0"?>
<NewDataSet>
<CGShows>
<RegionalID>Boston</RegionalID>
<SeqNbr>1</SeqNbr>
<ShowName>Boston IA Prelims</ShowName>
<ShowDate>2005-02-05T00:00:00.0000000-07:00</ShowDate>
<Type>SC</Type>
<PorF>P</PorF>
<RoundNbr>0</RoundNbr>
<Eqp1Judge>ADAMO S</Eqp1Judge>
<Mov1Judge>ADAMS R</Mov1Judge>
<Ens1Judge>O'MELIA K</Ens1Judge>
<GE1Judge>ANDERSON M</GE1Judge>
<GE2Judge>CASTEEN D</GE2Judge>
<TaPJudge>CONNELL R</TaPJudge>
<PerfSched>
<RegionalID>Boston</RegionalID>
<SeqNbr>1</SeqNbr>
<PerfTime>2005-02-05T09:00:00.0000000-07:00</PerfTime>
<UnitID>2104</UnitID>
<Nickname>All Saints</Nickname>
<Class>IA</Class>
</PerfSched>
<PerfSched>
<RegionalID>Boston</RegionalID>
<SeqNbr>1</SeqNbr>
<PerfTime>2005-02-05T09:08:00.0000000-07:00</PerfTime>
<UnitID>2123</UnitID>
<Nickname>Phantom Brig. </Nickname>
<Class>IA</Class>
</PerfSched>
</CGShows>
<CGShows>
<RegionalID>Boston</RegionalID>
<SeqNbr>2</SeqNbr>
<ShowName>Open Prelims</ShowName>
..... etc ........
</CGShows>
</NewDataSet>

Nov 12 '05 #2

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

Similar topics

1
by: ron | last post by:
have been stuck on this for several days now. I am trying to create a reverse polish calculator and I'm stuck at an intermediate stage. This is what I know I have to do (just not sure how to do it...
1
by: Samuel Hon | last post by:
Hi I'm a bit stuck with a SELECT query. This is a simplified version of what I need. I've had a look in a few books and online but I'm definitely missing something. I'm trying to avoid looping...
2
by: Ed | last post by:
Hi, I'm stuck at the moment trying to work out how to access the value of a textfield which gets added in a DIV element. I have functions to add and remove the textfields from the elements as...
4
by: Astronomically Confused | last post by:
using System; using System.Collections; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; class HttpProcessor { private Socket s;
1
by: jessebasketball | last post by:
i am a very beginner programmer and am stuck on a very simple problem. I am trying to make a game where the user is presented with a scenerio and options. ie you are standing in the parking lot...
23
by: Peter Row | last post by:
Hi, I am currently working on a VB.NET project that has been going for quite a while. In the past it has been developed with a lot of compatibility VB6 functions and constants, e.g Left(),...
2
by: kulet | last post by:
"2nd post as i noone could do it" Hi guys! Got stuck with this.. I have a chunks of text separated with blanc line. All I need is to take every last 3 lines of that text before the blanc line...
11
by: Peted | last post by:
Im using c# 2005 express edition Ive pretty much finished an winforms application and i need to significantly improve the visual appeal of the interface. Im totaly stuck on this and cant seem...
8
by: Chris LaVelle | last post by:
I don't know the easiest way to explain this so, I'm going to give an example of how it is today....and what I'm trying to accomplish. in the header... typedef struct XXX_ELEMENT_tag { UINT8 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.