SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Parsing SQL Saturday Data – Getting the Titles

I wrote about downloading the SQL Saturday data with Powershell, and that has worked well. However, I also need to parse this data. You can look at a sample XML file from the site with this link, and examine the structure.

Essentially, it’s something like this:








I’ve left a lot out, but it’s not important. For my purposes, this is the main stuff I’m concerned about.

As a first step, I wanted to print out some information. I’m tackling this in stages, so this is the first step.


I found a number of ways to do this, but I liked the SelectNodes method. I won’t include all the code, since the loading of the XML file was covered in the previous post. I have the XML data in the $doc variable, so I did this:


That gives me this:


This is the path to an element in the document. However this isn’t what I care about here. I’ll need this later as I store other data, but for now I want session titles.

If I change my code to:

$doc.SelectNodes("//event") | Format-Table title, description

I get this:


That’s a good start. I didn’t need the description, but I wanted to show multiple values in the table as a test.

My plan was to get the speaker, but speaker isn’t an element below event. It’s below "Speakers", which is separate.

That’s somewhat OK, as I’ll need to parse those out appropriately. The next step is getting the speakers. A little more complicated. The speakers are a child element below the event.

I’ll tackle that in another post, because it’s slightly more tricky and I want to be sure I can devote a bit more time to discussing a way to do this.

In the meantime, I cleaned up the code to be simpler and used the


Filed under: Blog Tagged: powershell, SQL Saturday, syndicated, xml

The Voice of the DBA

Steve Jones is the editor of SQLServerCentral.com and visits a wide variety of data related topics in his daily editorial. Steve has spent years working as a DBA and general purpose Windows administrator, primarily working with SQL Server since it was ported from Sybase in 1990. You can follow Steve on Twitter at twitter.com/way0utwest


Leave a comment on the original post [voiceofthedba.wordpress.com, opens in a new window]

Loading comments...