473,810 Members | 3,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please ... example code due on looping though specific nodes

I am quite new to XML and posted a request for example code yesterday.
Unfortunately, I did not do a very good job in explaining what I was
looking for. Here is an example of a small piece of the file:

<Scoreboard>
<Events>
<Event ID="001212" Name="EventName 1" />
<Event ID="001213" Name="EventName 2" />
<Event ID="001214" Name="EventName 3" />
<Event ID="001215" Name="EventName 4" />
</Events>
<EventTypes>
<EventType ID="01" SingleGame="tru e" Name="EventName 1" />
<EventType ID="02" SingleGame="tru e" Name="EventName 2" />
<EventType ID="03" SingleGame="tru e" Name="EventName 3" />
<EventType ID="04" SingleGame="tru e" Name="EventName 4" />
<EventType ID="05" SingleGame="tru e" Name="EventName 5" />
<EventType ID="06" SingleGame="tru e" Name="EventName 6" />
<EventType ID="07" SingleGame="tru e" Name="EventName 7" />
</EventTypes>
<Teams>
<Team ID="11" City="City1" Name="Name1" City="City1"
Nickname="nickn ame1" Conference="Con ference1">
<Player ID="91" />
<Player ID="190" />
<Player ID="77" />
<Player ID="133" />
<Player ID="144" />
<Player ID="195" />
<Player ID="220" />
<Player ID="231" />
<Player ID="214" />
<Team ID="13" City="City2" Name="Name2" City="City2"
Nickname="nickn ame2" Conference="Con ference1">
<Player ID="91" />
<Player ID="190" />
<Player ID="77" />
<Player ID="133" />
<Player ID="144" />
<Player ID="195" />
<Player ID="220" />
<Player ID="231" />
<Player ID="214" />
</Team>
</Teams>
<Match ID="999" StatusType="6" IsChallengeEnab led="false"
VenueID="NBB" SchedDate="2006-07-30" SchedTime="13:0 0"
ElapsedTime="02 :01" Winner="H" Attendance="" Final="Y">
<ChairUmpires >
<ChairUmpire Num="1" Name="" />
<ChairUmpire Num="2" Name="" />
</ChairUmpires>
<Teams>
<Team ID="1" Type="H" ChallengesMade= "5" ChallengesWon=" 3">
<Player ID="162" Coach="N" />
<Player ID="92" Coach="N" />
<Player ID="127" Coach="N" />
<Player ID="183" Coach="N" />
<Player ID="58" Coach="Y" />
<Stats FSPts="77" FSPtsWon="53" SSPts="21" SSPtsWon="11"
FSAces="2" SSAces="2" DF="2" TeamBrkPts="16" TeamBrkPtsWon=" 6"
TotPtsWon="110" TeamDeucePts="6 " TeamDeucePtsWon ="1" GamesPlayed="35 "
GamesWon="21" />
</Team>
</Match>
</Scoreboard>

How could I loop through a specific node, such as "Scoreboard/Teams"
and pull out all the information for ONLY that specific node? Once
that is done I would like to be able to move to another node such as
"Match/Teams" and loop through only that node and get all the info. I
would not need to loop through every node in the file, just specific
ones.

As I mentioned, this is just a small sample of the file, it is more
complex than this, but if I could get to this stage I could figure the
rest out. All this info must be put into a database.

Please if anyone has an example on how to do this, I would really
appreciate it. I am in urgent need of getting this done immediately.

Thanks,
Steve

Jun 3 '07
67 2693

"Jon Skeet [C# MVP]" <sk***@pobox.co mwrote in message
news:MP******** *************@m snews.microsoft .com...
<"Mr. Arnold" <MR. Ar****@Arnold.c om>wrote:

<snip>
And you will have to live with criticism from other
that feel embarrassed on behalf of the NG.

Yeah know, I don't care what others think. It means nothing to me.

<snip>

I think you'll find you *will* care if you have a question that *you*
want answering and no-one is willing to help because of the attitude
you've been displaying in this thread and others.
Not to be rude here, but if I want a question answered, then I know how to
go find that answer, if I had to do that.
I know that *I'd*
certainly rather spend time trying to help someone who has a history of
being polite than someone who is often rude and unwilling to
acknowledge mistakes.
What mistakes were those? Now, I may see things in a different light, which
I do see, because I do come from a different background or environment than
most posting in this NG, which is the streets I grew up in and still deal
with at times. I will apply that street mentality at times in a NG. But that
doesn't mean anything is a mistake.
I don't have enough time to answer every
question, so I have to apply some criteria to work out which ones to
spend effort on. Politeness is one of those criteria. Maybe that's just
me, but I strongly suspect it isn't.
I am not trying to be rude here. I don't think I would ask for any help,
because I know how to go find the answer, particularly when it comes to
programming and the MS platform.

The key to anything being talked about in this NG or any NG is this.

Does one know how to find the information for a given problem and apply the
information to produce a viable solution? That's what the Internet is about.
And if you know how to go find that information, you do, and if you don't,
then you don't know how to do it. There are no in betweens.

Jun 3 '07 #21
On Sun, 03 Jun 2007 16:38:22 -0700, Mr. Arnold <MR. <Ar****@Arnold. com>>
wrote:
Not to be rude here,
"Not to be rude"? A little too late for that, don't you think?
but if I want a question answered, then I know how to go find that
answer, if I had to do that.
The same thing could be said of practically EVERY question asked in this
newsgroup. Why should we bother answering *any* question, given that's
the case?
>I know that *I'd*
certainly rather spend time trying to help someone who has a history of
being polite than someone who is often rude and unwilling to
acknowledge mistakes.

What mistakes were those?
Well, for me the defining moment in your introduction of yourself to this
newsgroup was when you refused to acknowledge the error in claiming that
modifying a loop index from within the loop would in and of itself make
the loop "blow up" (your words).

You've had your share of other missteps, IMHO, but I'll bet that's the one
that sticks in most people's minds.
Now, I may see things in a different light, which I do see, because I do
come from a different background or environment than most posting in
this NG, which is the streets I grew up in and still deal with at times.
Huh? This is about "street cred", or some silly notion like that?

Here's a hint: even if you do live in a rough neighborhood (whatever
that's supposed to mean), that doesn't justify you going around insulting
people.
I will apply that street mentality at times in a NG. But that doesn't
mean anything is a mistake.
I think that the mistakes Jon refers to are factual errors you've made.
Being rude is also a mistake, but I don't think that's the point he was
making.
I am not trying to be rude here. I don't think I would ask for any
help, because I know how to go find the answer, particularly when it
comes to programming and the MS platform.
Again, if everyone should be expected to just "go find the answer" rather
than ask the question here, why should anyone ever post a question here?
The key to anything being talked about in this NG or any NG is this.

Does one know how to find the information for a given problem and apply
the information to produce a viable solution? That's what the Internet
is about. And if you know how to go find that information, you do, and
if you don't, then you don't know how to do it. There are no in betweens.
If "there are no in betweens", then why do we have this newsgroup at all?

Like Jon, I do keep track of the people who can't behave themselves, and I
do avoid answering their questions. But more importantly, even if you do
not expect to ever ask a question here, that does not make it okay for you
to go around abusing people.

I find it unfortunate that in the last few weeks, we've had at least two
off-topic threads by people who basically refuse to act politely, only
because there are no direct consequences to them for not doing so. I find
myself wondering what ever happened to the notion of doing something just
because "it's the right thing to do" (and I'm not talking oatmeal here).

Pete
Jun 3 '07 #22
On Sun, 03 Jun 2007 16:30:38 -0700, gator <gl****@gmail.c omwrote:
I've found part of the answer to my question (thanks to several on
this thread) but I am unsure of how to finish. Here is the code I
have now:

[...]

foreach (XmlNode node in list)
{
s += "Title: " + node["EventType"].Attributes["ID"].Value ;
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This gives me the first instance of the attribute "ID", which is a
good start, but how do I loop through the whole node "EventType" and
retreive the whole list of attributes?
You need to implement some sort of recursive processing, where you use the
XmlNode.ChildNo des property to look at the XML nodes within the given node.

It can either be a true recursive method that calls itself and has the
logic in it to handle every single node type you expect to see,
maintaining the necessary state to know what to do with those nodes. Or
you can write special-purpose methods for each node type, calling each as
appropriate from the others as you come across each node.

But the key is that once you have an XML node, you can enumerate all of
the nodes within it by using the ChildNodes property.

Pete
Jun 4 '07 #23
On Jun 3, 7:53 pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
wrote:
On Sun, 03 Jun 2007 16:38:22 -0700, Mr. Arnold <MR. <Arn...@Arnold. com>>
wrote:
Not to be rude here,

"Not to be rude"? A little too late for that, don't you think?
but if I want a question answered, then I know how to go find that
answer, if I had to do that.

The same thing could be said of practically EVERY question asked in this
newsgroup. Why should we bother answering *any* question, given that's
the case?
I know that *I'd*
certainly rather spend time trying to help someone who has a history of
being polite than someone who is often rude and unwilling to
acknowledge mistakes.
What mistakes were those?

Well, for me the defining moment in your introduction of yourself to this
newsgroup was when you refused to acknowledge the error in claiming that
modifying a loop index from within the loop would in and of itself make
the loop "blow up" (your words).

You've had your share of other missteps, IMHO, but I'll bet that's the one
that sticks in most people's minds.
Now, I may see things in a different light, which I do see, because I do
come from a different background or environment than most posting in
this NG, which is the streets I grew up in and still deal with at times.

Huh? This is about "street cred", or some silly notion like that?

Here's a hint: even if you do live in a rough neighborhood (whatever
that's supposed to mean), that doesn't justify you going around insulting
people.
I will apply that street mentality at times in a NG. But that doesn't
mean anything is a mistake.

I think that the mistakes Jon refers to are factual errors you've made.
Being rude is also a mistake, but I don't think that's the point he was
making.
I am not trying to be rude here. I don't think I would ask for any
help, because I know how to go find the answer, particularly when it
comes to programming and the MS platform.

Again, if everyone should be expected to just "go find the answer" rather
than ask the question here, why should anyone ever post a question here?
The key to anything being talked about in this NG or any NG is this.
Does one know how to find the information for a given problem and apply
the information to produce a viable solution? That's what the Internet
is about. And if you know how to go find that information, you do, and
if you don't, then you don't know how to do it. There are no in betweens.

If "there are no in betweens", then why do we have this newsgroup at all?

Like Jon, I do keep track of the people who can't behave themselves, and I
do avoid answering their questions. But more importantly, even if you do
not expect to ever ask a question here, that does not make it okay for you
to go around abusing people.

I find it unfortunate that in the last few weeks, we've had at least two
off-topic threads by people who basically refuse to act politely, only
because there are no direct consequences to them for not doing so. I find
myself wondering what ever happened to the notion of doing something just
because "it's the right thing to do" (and I'm not talking oatmeal here).

Pete


=============== =============== =============== =============== =============== =============== =============

uh, excuse me folks ... but could we move the psychiatric session to
another thread so I could see if anyone can help me with the OTHER
topic of the thread, "XML Parsing"?

=)

Thanks, much appreciated!

- Steve (the original poster before this turned into the "Arnie seeks
therapy thread").

Jun 4 '07 #24
On Sun, 03 Jun 2007 17:04:20 -0700, gator <gl****@gmail.c omwrote:
uh, excuse me folks ... but could we move the psychiatric session to
another thread so I could see if anyone can help me with the OTHER
topic of the thread, "XML Parsing"?
Uh, well...you could always move your question about XML back to the
original thread you posted. It seems to have remained relatively
uncluttered. :)
Jun 4 '07 #25
If I respected your opinion, I might listen. I don't respect you, period. So
you might as well stop posting to me.

Jun 4 '07 #26
"Arne Vajhøj" <ar**@vajhoej.d kwrote in message
news:46******** *************** @news.sunsite.d k...
Your behavior is or should be a problem for all participants in
this newsgroup.

And you will have to live with criticism from other
that feel embarrassed on behalf of the NG.
Not just this newsgroup - this guy acts in similar vein on several others on
the microsoft server...

Well overdue for the killfile...
--
http://www.markrae.net

Jun 4 '07 #27

"Mark Rae" <ma**@markNOSPA Mrae.netwrote in message
news:uz******** ********@TK2MSF TNGP03.phx.gbl. ..
"Arne Vajhøj" <ar**@vajhoej.d kwrote in message
news:46******** *************** @news.sunsite.d k...
>Your behavior is or should be a problem for all participants in
this newsgroup.

And you will have to live with criticism from other
that feel embarrassed on behalf of the NG.

Not just this newsgroup - this guy acts in similar vein on several others
on the microsoft server...

Well overdue for the killfile...
Well you please do it and stay out of my face. That's all I ask of any of
you is to stay out of my face. You'll find that I don't have conversations
with the regulars in any NG. It's best that way.
Jun 4 '07 #28
On Sun, 03 Jun 2007 17:26:29 -0700, Mr. Arnold <MR. <Ar****@Arnold. com>>
wrote:
If I respected your opinion, I might listen. I don't respect you,
period. So you might as well stop posting to me.
It means nothing to me regarding whether you respect my opinion or not.
There are factual statements here that pertain to you. In any case, if my
posts are so useless to you, I really wish you'd just put me in your
killfile and be done with it. If I "might as well stop posting to you",
why do you bother to reply at all?
Jun 4 '07 #29

Disappear Peter, you mean nothing to me. And the sooner you understand
that, the better things will be. The moment I recognize anyone as being a
serious regular in a NG whether that be top posting for help or posting down
in a thread, it's over for him or her. I will not initiate a post to that
person, as I have no need to do that. I mind my own business, help someone
if I can, and in general, I mind my own business.

Jun 4 '07 #30

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

Similar topics

1
2612
by: Az Tech | last post by:
Hi people, (Sorry for the somewhat long post). I request some of the people on this group who have good experience using object-orientation in the field, to please give some good ideas for topics to include in a course on object-orientation that I'm going to conduct. (I will later summarize all the replies and discussion, for the
2
2850
by: csx | last post by:
Hi all, I'm trying to count the number of leafnodes for a particular node. What im trying to do is make a function, that taking the tree structure: key row desc parent 1 1 A 0 2 2 B 1 3 2 C 1 4 3 D 3
2
6498
by: Claire Reed | last post by:
Dear All, I am repeatedly encountering a problem whilst looping through XML Nodes and I am unsure as to what is going on and how I can get around it. I load the following XML document into an XmlDocument object using LoadXml: <?xml version="1.0" encoding="UTF-8"?>
4
1313
by: Shapper | last post by:
Hello, I have a XML file that includes the node <item>: .... <title>...</title> <url>...</url> <item> <title>title 01</title> <description>description 01</description> </item>
2
2597
by: pmcguire67 | last post by:
There has been a lot of discussion lately about extending the treeview control to allow finding a node by key rather than by index. Everyone seems to agree that a hashtable is needed to accomplish this. Also, there is a KB article (http://support.microsoft.com/default.aspx?scid=kb;en-us;311318) purporting to show you how to extend the treenode to include a key. This article seems to be nearly useless to me, as (despite adding a...
12
291
by: **Developer** | last post by:
Dim tvn As TreeNode For Each tvn In rootNode.Nodes ....SNIP rootNode.Nodes.Remove(tvn) Next
1
9667
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
9
1919
by: TF | last post by:
Hello all, I made a ASP.NET 2.0 site that shows possible "recipes" for paint colors stored in an access dbase. Basically, 1000 colors are stored with specific RGB values in separate columns. A user sees all the colors listed on the page with hyperlinks that open the "mixes" page. The mixes page goes through each record, compares it with all other records in a ratio up to "maxratio". If it finds a ratio that matches the redvalue of...
6
2282
by: fido19 | last post by:
Once upon a time, there lived a chimpanzee called Luycha Bandor (aka Playboy Chimp). Luycha was unhappily married to Bunty Mona, a short but cute little lady chimp. Luycha was tall and handsome – he was feeling uncomfortable taking Bunty to public places along with him. People would stare at them all the while. At one point, Luycha could not stand it anymore and he decided to do some justice to his name. He started looking for a new hope in...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10124
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.