iphone - get birthdate, birthplace from mediawiki xml format api -
i trying details of person mediawiki in objective-c. using http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&rvsection=0&titles=albert_einstein&format=xml
i getting data in response follow:
</i>$0 = 0x07562e60 <?xml version="1.0"?><api><query><normalized><n from="albert_einstein" to="albert einstein" /></normalized><pages><page pageid="736" ns="0" title="albert einstein"><revisions><rev contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve">{{redirect|einstein}} {{good article}} {{pp-semi|small=yes}}{{pp-move-indef}} {{infobox scientist | name = albert einstein | image = einstein 1921 f schmutzer.jpg | caption = albert einstein in 1921 | birth_date = {{birth date|df=yes|1879|3|14}} | birth_place = [[ulm]], [[kingdom of württemberg]], [[german empire]] | death_date = {{death date , age|df=yes|1955|4|18|1879|3|14}} | death_place = {{nowrap|[[princeton, new jersey|princeton]], [[new jersey]], u.s.}} | children = [[lieserl einstein|lieserl]] (1902-1903?)<br />[[hans albert einstein|hans albert]] (1904-1973)<br />[[eduard einstein|eduard "tete"]] (1910-1965) | spouse = [[mileva marić]]&nbsp;(1903–1919)<br />{{nowrap|[[elsa löwenthal]]&nbsp;(1919–1936)}} | residence = germany, italy, switzerland, austria, belgium, united states | citizenship = {{plainlist| </i>
now want birthdate person in objective-c. somehow can manage birth_date also. question is, proper parsing available parsing these data?
this not way. use web api client library. better yet, use proper api, i.e. – data question – wikidata's.
see wbgetclaims docs , example: https://www.wikidata.org/w/api.php?action=wbgetclaims&entity=q937&property=p569 gives
{ "claims": { "p569": [ { "id": "q937$2ecb21c3-4db1-54e8-27c4-a8a40541930c", "mainsnak": { "snaktype": "value", "property": "p569", "datatype": "time", "datavalue": { "value": { "time": "+00000001879-03-14t00:00:00z", "timezone": 0, "before": 0, "after": 0, "precision": 11, "calendarmodel": "http://www.wikidata.org/entity/q1985727" }, "type": "time" } }, "type": "statement", "rank": "normal", "references": [ { "hash": "d6e3ab4045fb3f3feea77895bc6b27e663fc878a", "snaks": { "p143": [ { "snaktype": "value", "property": "p143", "datatype": "wikibase-item", "datavalue": { "value": { "entity-type": "item", "numeric-id": 206855 }, "type": "wikibase-entityid" } } ] }, "snaks-order": [ "p143" ] }, { "hash": "7eb64cf9621d34c54fd4bd040ed4b61a88c4a1a0", "snaks": { "p143": [ { "snaktype": "value", "property": "p143", "datatype": "wikibase-item", "datavalue": { "value": { "entity-type": "item", "numeric-id": 328 }, "type": "wikibase-entityid" } } ] }, "snaks-order": [ "p143" ] }, { "hash": "f991bf419530b161a136a5c4e55c49909074ce49", "snaks": { "p248": [ { "snaktype": "value", "property": "p248", "datatype": "wikibase-item", "datavalue": { "value": { "entity-type": "item", "numeric-id": 36578 }, "type": "wikibase-entityid" } } ], "p813": [ { "snaktype": "value", "property": "p813", "datatype": "time", "datavalue": { "value": { "time": "+00000002014-04-09t00:00:00z", "timezone": 0, "before": 0, "after": 0, "precision": 11, "calendarmodel": "http://www.wikidata.org/entity/q1985727" }, "type": "time" } } ] }, "snaks-order": [ "p248", "p813" ] } ] } ] } }
Comments
Post a Comment