c# - How to Parsing XML? -
how parse xml.here, want take name , picture url..
i trying code..
facebookclient client = new facebookclient(); var friendlistdata = client.get("https://graph.facebook.com/?ids=100005000000000&fields=name,picture"); jobject friendlistjson = jobject.parse(friendlistdata.tostring()); string json = convert.tostring(friendlistjson); xmldocument doc = (xmldocument)jsonconvert.deserializexmlnode(json, "root"); string xml = doc.innerxml; xdocument myxdoc = xdocument.load(new stringreader(xml)); var list = loc in myxdoc.descendants("root").elements("100005000000000") select new { //id = loc.element("id").value, name = loc.element("name").value, url=loc.element("url").value, };
but, getting error "name cannot begin '1' character, hexadecimal value 0x31." please correct it.
<root> <100005000000000> <name>xxx</name> <id>100005000000000</id> <picture> <data> <url>http://profile.ak.fbcdn.net/hprofile-ak-prn2/000000_100005000000000_1666666666_q.jpg</url> <is_silhouette>false</is_silhouette> </data> </picture> </100005000000000> </root>
here json
{ "100005000000000": { "name": "xxxx", "id": "100005000000000", "picture": { "data": { "url": "profile.ak.fbcdn.net/hprofile-ak-prn2/…;, "is_silhouette": false } } } }
Comments
Post a Comment