Google Groups

Getting bills in .Net


Andy Xufuris Feb 28, 2012 12:25 PM
Posted in group: Sunlight Labs API Discussion
I'm working in .Net and i am trying to figure out how to pull these
bills into objects.  I have tried this but it hasn't worked.

int i = 111;
                XDocument xmlDoc = XDocument.Load("http://
api.realtimecongress.org/api/v1/bills.xml?
apikey=[apikey]&session=
" + i.ToString());

                var tutorials = from tutorial in
xmlDoc.Descendants("bill")
                                select new
                                {
                                    SponsorID =
tutorial.Element("sponsor_id").Value,
                                    SponsorFirstName =
tutorial.Element("sponsor").Element("first_name").Value,
                                    SponsorLastName =
tutorial.Element("sponsor").Element("last_name").Value,
                                    LastActionText =
tutorial.Element("last_action").Element("text").Value,
                                    BillNumber =
tutorial.Element("number").Value,
                                    BillType =
tutorial.Element("bill_type").Value,
                                    Enacted =
tutorial.Element("enacted").Value,
                                    EnactedDateTime =
tutorial.Element("enacted_at").Value,
                                    CongressSession =
tutorial.Element("session").Value,
                                    HousePassageResult =
tutorial.Element("house_passage_result").Value,
                                    HousePassageDateTime =
tutorial.Element("house_passage_result_at").Value,
                                    SenatePassageResult =
tutorial.Element("senate_passage_result").Value,
                                    SenatePassageDateTime =
tutorial.Element("senate_passage_result_at").Value,
                                    ShortTitle =
tutorial.Element("short_title").Value,
                                };

Has anyone done this, and can they help me through it?