[dba-VB] XML LINQ Help!

Gustav Brock Gustav at cactus.dk
Tue Sep 29 10:01:08 CDT 2009


Hi Michael

Don't know about XElement, but why not replicate the schema in a DataSet? Method ReadXmlSchema does that while method ReadXml reads the data.

But aren't you reading the data directly from the web service? You should not need to store them as an XML file first. I don't have code at hand and have not played with this yet, so I may be wrong.

/gustav


>>> michael at ddisolutions.com.au 29-09-2009 05:33 >>>
Hi guys,

VS2008 C#

I've grabbed some XML data from a web service and I need to do some
operations on it. This is all new to me and I'm a bit lost trying to
follow MSDN docs.
The data looks like this.

<Data>
  <Summary MID="SR_20090924">
    <VenueName>HAWKESBURY (NSW)</VenueName>
    <Type>R</Type>
    <Events>9</Events>
    <Track>GOOD    </Track>
    <Weather>FINE    </Weather>
    <Races>
      <Race RID="SR_20090924_01">
        <Name>MADE JEWELLERY F&M MDN HCP</Name>
        <Distance>1400m     </Distance>
        <Class>
        </Class>
        <RunnerNo Acceptors="13">13</RunnerNo>
        <JumpTime>12:10</JumpTime>
        <TimeToJump>+02:35:19</TimeToJump>
        <RaceStatus>Betting Open</RaceStatus>
      </Race>
  </Summary>
  <Summary ...>
	//more
  </Summary>
</Data>

I can load the xml using XElement racesFromFile = XElement.Load ( @path
);

I need to do a variety of things.

How do I get all the Summary Attributes?  MID = ?

How do I get VenueNAme?

And all the raceIDs?

Then using LINQ(?) get data specific to a RaceID?

Maybe a pointer to a good tutorial would be appreciated.

Cheers

Michael M






More information about the dba-VB mailing list