Parsing google feed with linq to xml -


I am trying to parse the XML feed which I get through LINQ 2 XML via the Google Contacts API I am This is what the feed looks for:

  & lt; Feed xmlns = "http://www.w3.org/2005/Aut" xmlns: openSearch = "http://a9.com/-/spec/opensearchrs/1.0/" xmlns: gContact = "http: // schemas .google.com / contact / 2008 "xmlns: batch =" http://schemas.google.com/gdata/batch "xmlns: gd =" http://schemas.google.com/g/2005"> & Lt; ID & gt; Myemailaddress@gmail.com< / Id & gt; & Lt; Update & gt; 2010-06-11T17: 37: 06.561Z & lt; / Update & gt; & Lt; Category Scheme = "http://schemas.google.com/g/2005#kind" = "http://schemas.google.com/contact/2008#contact" /> & Lt; Title type = "text" & gt; My Contacts & lt; / Title & gt; & Lt; Link rel = "optional" type = "text / html" href = "http://www.google.com/" /> & Lt; Link rel = "http://schemas.google.com/g/2005#feed" type = "application / atom + xml" href = "http://www.google.com/m8/feeds/contacts/ Myemailaddress% 40gmail.com / full "/> & Lt; Link rel = "http://schemas.google.com/g/2005#post" type = "application / atom + xml" href = "http://www.google.com/m8/feeds/contacts/ Myemailaddress% 40gmail.com / full "/> & Lt; Link rel = "http://schemas.google.com/g/2005#batch" type = "application / atom + xml" href = "http://www.google.com/m8/feeds/contacts/ Myemailaddress% 40gmail.com / full / batch "/> & Lt; Link rel = "self" type = "application / atom + xml" href = "http://www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/full?max-results=25" / & Gt; & Lt; Author & gt; & Lt; Name & gt; My name & lt; / Name & gt; & Lt; Email & gt; Myemailaddress@gmail.com< / Email & gt; & Lt; / Author & gt; & Lt; Generator version = "1.0" uri = "http://www.google.com/m8/feeds" & gt; Contact & lt; / Generator & gt; & Lt; OpenSearch: totalResults & gt; 19 & lt; / OpenSearch: totalResults & gt; & Lt; OpenSearch: STARTINDEX & gt; 1 & lt; / OpenSearch: STARTINDEX & gt; & Lt; OpenSearch: itemsPerPage & gt; 25 & lt; / OpenSearch: itemsPerPage & gt; & Lt; Entry & gt; & Lt; ID & gt; Http: //www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/base/0< / Id & gt; & Lt; Update & gt; 2010-01-26T20: 34: 03.802Z & lt; / Update & gt; & Lt; Category Scheme = "http://schemas.google.com/g/2005#kind" = "http://schemas.google.com/contact/2008#contact" /> & Lt; Title type = "text" & gt; Contact name & lt; / Title & gt; & Lt; Link rel = "http://schemas.google.com/contacts/2008/rel#edit-photo" type = "image / *" href = "http://www.google.com/m8/feeds/ photo / Media / myemailaddress% 40gmail.com / 0 / O-ydnzWMJcfZWqT-6gGetw "/> & Lt; Link rel = "http://schemas.google.com/contacts/2008/rel#photo" type = "image / *" href = "http://www.google.com/m8/feeds/photos/ media / Myemailaddress% 40gmail.com / 0 "/> & Lt; Link rel = "self" type = "application / atom + xml" href = "http://www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/full/0" / & gt; & Lt; Link rel = "edit" type = "application / atom + xml" href = "http://www.google.com/m8/feeds/contacts/myemailaddress%40gmail.com/full/0/1264538043802000" /> & Lt; Gd: email rel = "http://schemas.google.com/g/2005#other" address = "someaddress@gmail.com" primary = "true" /> & Lt; / Entry & gt; & Lt; / Feed & gt;  

I have tried to do several things with linux 2 sql, but they did not work. Even this simple code does not work:

 using  (file stream stream = file. Opener ("response.xml") {XmlReader Reader = XmlReader.Create ( Stream); XDocument Document = XDocument.Load (Reader); Excitement Feed = Doctor Element ("feed"); If (feed == empty) {Console.WriteLine ("no feed found"); } Excelm ID = Doctor Element ("id"); If (id == null) {Console.WriteLine ("id is empty"); }}  

The problem is that id and feed are both null here What am i doing

You must specify the namespace of the element in your username:

  XElement feed = Doctor.Ement ("{http://www.w3.org/2005/Atom}feed"); If (feed == faucet) {Console.WriteLine ("no feed found"); }  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -