Help with large XML file

G

gator

Hi,

I am trying to parse out a large and confusing (to me anyway) XML
file. I have worked with small files that have a few nodes, with
elements, but this file is beyond what I know. Here is a small piece
of the XML (it's MUCH larger than this:

<Scoreboard>
<Events>
<Event ID="001212" Name="EventName1" />
<Event ID="001213" Name="EventName2" />
<Event ID="001214" Name="EventName3" />
<Event ID="001215" Name="EventName4" />
</Events>
<EventTypes>
<EventType ID="01" SingleGame="true" Name="EventName1" />
<EventType ID="02" SingleGame="true" Name="EventName2" />
<EventType ID="03" SingleGame="true" Name="EventName3" />
<EventType ID="04" SingleGame="true" Name="EventName4" />
<EventType ID="05" SingleGame="true" Name="EventName5" />
<EventType ID="06" SingleGame="true" Name="EventName6" />
<EventType ID="07" SingleGame="true" Name="EventName7" />
</EventTypes>
<Teams>
<Team ID="11" City="City1" Name="Name1" City="City1"
Nickname="nickname1" Conference="Conference1">
<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" />
</Teams>
<Team ID="13" City="City2" Name="Name2" City="City2"
Nickname="nickname2" Conference="Conference1">
<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>
</Scoreboard>

Does anyone have example code on how to parse out the info in this
example?

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.

Thanks,
Steve
 
P

Peter Duniho

[...]
Does anyone have example code on how to parse out the info in this
example?

What exactly are you having trouble with? The basic concepts of parsing
the data are the same, regardless of the size of the file.

The sample you've provided has nested values, which you *could* represent
in C# as classes containing references to other classes. For example, a
top-level class "Scoreboard" that contains an array of "Event"s, an array
of "EventType"s, etc. Within the array of "Team" instances, each "Team"
instance would also have an array of "Player"s.

Other than that, I'm having difficulty figuring out exactly what you're
asking here.

Pete
 
M

Mr. Arnold

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top