Retrieve data.gov datasets

March 13, 2016

214 views
40 downloads


Report Abuse
This experiment dynamically retrieves XML data from data.gov for any data.gov data set with API access and converts XML to dataset
This experiment uses XML library to retrieve any government public dataset available as API in XML format using data.gov APIs for example ppi data shown [here][1]. This experiment first finds the number of records in the XML using XMLSize command along with location for first record. Once it knows the total records, it parses each record and converts each record to individual row of data returned by the API. It uses XMLParse to parse the HTML content. It uses XMLRoot to find the root of XML and then it traverses each node to retrieve specific elements such as Year, Period and value. It uses XMLName, XMLValue and XMLAttr to convert the final XML leaf node to desired record. [1]: http://catalog.data.gov/dataset/producer-price-index/resource/63cc78db-d488-4852-8c0d-724a8aa460b3