Skip to content

Instantly share code, notes, and snippets.

@kwmt
Forked from bemasher/Castle.xml
Last active November 9, 2021 01:16
Show Gist options
  • Star 55 You must be signed in to star a gist
  • Fork 16 You must be signed in to fork a gist
  • Save kwmt/6135123 to your computer and use it in GitHub Desktop.
Save kwmt/6135123 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8" ?>
<Data>
<Series>
<id>83462</id>
<Actors>|Nathan Fillion|Stana Katic|Molly C. Quinn|Jon Huertas|Seamus Dever|Tamala Jones|Susan Sullivan|Ruben Santiago-Hudson|Monet Mazur|</Actors>
<Airs_DayOfWeek>Monday</Airs_DayOfWeek>
<Airs_Time>10:00 PM</Airs_Time>
<ContentRating>TV-PG</ContentRating>
<FirstAired>2009-03-09</FirstAired>
<Genre>|Drama|</Genre>
<IMDB_ID>tt1219024</IMDB_ID>
<Language>en</Language>
<Network>ABC</Network>
<NetworkID></NetworkID>
<Overview>Rick Castle is one of the world's most successful crime authors. But when his rock star lifestyle isn't enough, this bad boy goes looking for new trouble and finds it working with smart, beautiful Detective Kate Beckett. Inspired by her professional record and intrigued by her buttoned-up personality, Castle's found the model for his bold new character whether she likes it or not. Now with the mayor's permission, Castle is on her case and in her way. Kate's initial disdain for Castle turns to grudging respect as he quickly proves that a background in plotting murders can be a valuable asset in catching killers. As they solve a new crime together each week, their partnership grows as does their love-hate relationship. These two may not always see eye to eye, but together they might just write a whole new chapter in crime-solving.</Overview>
<Rating>8.9</Rating>
<RatingCount>200</RatingCount>
<Runtime>60</Runtime>
<SeriesID>75394</SeriesID>
<SeriesName>Castle (2009)</SeriesName>
<Status>Continuing</Status>
<added>2008-10-17 15:05:50</added>
<addedBy>3071</addedBy>
<banner>graphical/83462-g3.jpg</banner>
<fanart>fanart/original/83462-24.jpg</fanart>
<lastupdated>1316123743</lastupdated>
<poster>posters/83462-6.jpg</poster>
<zap2it_id>EP01085588</zap2it_id>
</Series>
<Episode>
<id>398671</id>
<Combined_episodenumber>1.0</Combined_episodenumber>
<Combined_season>1</Combined_season>
<DVD_chapter></DVD_chapter>
<DVD_discid></DVD_discid>
<DVD_episodenumber>1.0</DVD_episodenumber>
<DVD_season>1</DVD_season>
<Director>Rob Bowman</Director>
<EpImgFlag>7</EpImgFlag>
<EpisodeName>Flowers for Your Grave</EpisodeName>
<EpisodeNumber>1</EpisodeNumber>
<FirstAired>2009-03-09</FirstAired>
<GuestStars>Stephen J. Cannell|James Patterson|Jon Huertas|Seamus Dever|Dan Castellaneta|Tamala Jones|Keir Dullea|Colby French|Brian Avers</GuestStars>
<IMDB_ID>tt1303973</IMDB_ID>
<Language>en</Language>
<Overview>Author Richard Castle joins NYC Detective Kate Beckett to help solve the case of a serial killer who is reenacting murders from Castle's novels; Castle becomes very intrigued with the murders and continues to shadow Beckett, much to her chagrin.</Overview>
<ProductionCode>101</ProductionCode>
<Rating>7.8</Rating>
<RatingCount>79</RatingCount>
<SeasonNumber>1</SeasonNumber>
<Writer>Andrew W. Marlowe</Writer>
<absolute_number>1</absolute_number>
<filename>episodes/83462/398671.jpg</filename>
<lastupdated>1302942096</lastupdated>
<seasonid>36354</seasonid>
<seriesid>83462</seriesid>
</Episode>
<Episode>
<id>424159</id>
<Combined_episodenumber>2.0</Combined_episodenumber>
<Combined_season>1</Combined_season>
<DVD_chapter></DVD_chapter>
<DVD_discid></DVD_discid>
<DVD_episodenumber>2.0</DVD_episodenumber>
<DVD_season>1</DVD_season>
<Director>John Terlesky</Director>
<EpImgFlag>2</EpImgFlag>
<EpisodeName>Nanny McDead</EpisodeName>
<EpisodeNumber>2</EpisodeNumber>
<FirstAired>2009-03-16</FirstAired>
<GuestStars>Jayne Brook|Sarah Drew|George Newbern|Jason Brooks|Melinda Page Hamilton|Ken Lerner|Michael Graziadei|Len Lesser</GuestStars>
<IMDB_ID>tt1321564</IMDB_ID>
<Language>en</Language>
<Overview>When a body of a young woman is found inside the dryer at a laundry room, Castle and Beckett uncover that the young woman worked as a nanny in the upscale building. Meanwhile, as Castle works on his &quot;Nikki Heat&quot; novel series he watches Beckett's actions as she works the murder case. </Overview>
<ProductionCode>102</ProductionCode>
<Rating>7.5</Rating>
<RatingCount>65</RatingCount>
<SeasonNumber>1</SeasonNumber>
<Writer>Barry Schindel</Writer>
<absolute_number>2</absolute_number>
<filename>episodes/83462/424159.jpg</filename>
<lastupdated>1302508691</lastupdated>
<seasonid>36354</seasonid>
<seriesid>83462</seriesid>
</Episode>
<Episode>
<id>424160</id>
<Combined_episodenumber>4.0</Combined_episodenumber>
<Combined_season>1</Combined_season>
<DVD_chapter></DVD_chapter>
<DVD_discid></DVD_discid>
<DVD_episodenumber>4.0</DVD_episodenumber>
<DVD_season>1</DVD_season>
<Director>Rob Bowman</Director>
<EpImgFlag>7</EpImgFlag>
<EpisodeName>Hedge Fund Homeboys</EpisodeName>
<EpisodeNumber>3</EpisodeNumber>
<FirstAired>2009-03-23</FirstAired>
<GuestStars>Jamie Chung|Nolan Gerard Funk|Michelle Page|Kunal Sharma|Steve Talley|Charlie Finn|Caitlin Dulany</GuestStars>
<IMDB_ID>tt1327257</IMDB_ID>
<Language>en</Language>
<Overview>When a teenaged boy whose family has recently fallen on hard times is found dead in a boat in Central Park, Castle and Beckett must piece together the mystery behind the boy's final moments. Meanwhile, Castle mulls over leaving Martha home while he chaperones Alexis' trip to Washington, D.C.</Overview>
<ProductionCode>103</ProductionCode>
<Rating>7.6</Rating>
<RatingCount>59</RatingCount>
<SeasonNumber>1</SeasonNumber>
<Writer>David Grae</Writer>
<absolute_number>4</absolute_number>
<filename>episodes/83462/424160.jpg</filename>
<lastupdated>1302508800</lastupdated>
<seasonid>36354</seasonid>
<seriesid>83462</seriesid>
</Episode>
<Episode>
<id>424161</id>
<Combined_episodenumber>3.0</Combined_episodenumber>
<Combined_season>1</Combined_season>
<DVD_chapter></DVD_chapter>
<DVD_discid></DVD_discid>
<DVD_episodenumber>3.0</DVD_episodenumber>
<DVD_season>1</DVD_season>
<Director>Rob Bowman</Director>
<EpImgFlag>7</EpImgFlag>
<EpisodeName>Hell Hath No Fury</EpisodeName>
<EpisodeNumber>4</EpisodeNumber>
<FirstAired>2009-03-30</FirstAired>
<GuestStars>Jonathan Banks|Bruno Campos|Michael Reilly Burke|Joshua LeBar|Lisa Waltz|Alicia Ziegler|Amy Hathaway</GuestStars>
<IMDB_ID>tt1318126</IMDB_ID>
<Language>en</Language>
<Overview>The investigation behind a body found wrapped in a rug on the sidewalk leads Castle and Beckett deep inside the world of New York City politics. The partners discover a world of expensive escorts, arrogant tycoons, corrupt investigators, and the effects of betrayal.</Overview>
<ProductionCode>104</ProductionCode>
<Rating>7.6</Rating>
<RatingCount>58</RatingCount>
<SeasonNumber>1</SeasonNumber>
<Writer>Andrew W. Marlowe</Writer>
<absolute_number>3</absolute_number>
<filename>episodes/83462/424161.jpg</filename>
<lastupdated>1302508861</lastupdated>
<seasonid>36354</seasonid>
<seriesid>83462</seriesid>
</Episode>
</Data>
Castle (2009) - 75394
S01E01 - Flowers for Your Grave - 2009-03-09
S01E02 - Nanny McDead - 2009-03-16
S01E03 - Hedge Fund Homeboys - 2009-03-23
S01E04 - Hell Hath No Fury - 2009-03-30
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"os"
)
type Query struct {
Series Show
// Have to specify where to find episodes since this
// doesn't match the xml tags of the data that needs to go into it
EpisodeList []Episode `xml:"Episode"`
}
type Show struct {
// Have to specify where to find the series title since
// the field of this struct doesn't match the xml tag
Title string `xml:"SeriesName"`
SeriesID int
Keywords map[string]bool
}
type Episode struct {
SeasonNumber int
EpisodeNumber int
EpisodeName string
FirstAired string
}
func (s Show) String() string {
return fmt.Sprintf("%s - %d", s.Title, s.SeriesID)
}
func (e Episode) String() string {
return fmt.Sprintf("S%02dE%02d - %s - %s", e.SeasonNumber, e.EpisodeNumber, e.EpisodeName, e.FirstAired)
}
func main() {
xmlFile, err := os.Open("Castle.xml")
if err != nil {
fmt.Println("Error opening file:", err)
return
}
defer xmlFile.Close()
b, _ := ioutil.ReadAll(xmlFile)
var q Query
xml.Unmarshal(b, &q)
fmt.Println(q.Series)
for _, episode := range q.EpisodeList {
fmt.Printf("\t%s\n", episode)
}
}
@rimidalv
Copy link

rimidalv commented Feb 5, 2014

Thanx for fix bugs

@lmmx
Copy link

lmmx commented Feb 27, 2016

Here's a version that can be run on the Go playground: play.golang.org/p/m99B12RaLe

@yairopro
Copy link

yairopro commented Jul 13, 2017

Thanks Immx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment