[dba-VB] XML LINQ Help!

Michael Maddison michael at ddisolutions.com.au
Tue Sep 29 18:51:52 CDT 2009


Hi Gustav,

I considered dumping the lot into a dataset but at the moment the end
result is supposed to be xml to be loaded into Excel.
And you are also correct that I don't need to load from a file. The web
service methods returns XmlElement, I wrote it out to a xmlDocument for
my convienience.

The client was going to handle the Excel side but is now having second
thoughts :-)
So now I'm looking at extracting just the data needed and exposing to
Excel as Arrays.
I think that will make it easier to control in Excel, if anyone has
other suggestions I'm all ears.

Cheers

Michael M


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



_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com





More information about the dba-VB mailing list