I picked up this little gem of a trick from Herman Lintvelt’s (@hermanlintvelt) Domain Specific Language (DSL) talk, at AppsWorld Africa at the beginning of the month, where he walked through the processes of creating a DSL for a SASSI Pocket Guide app for Android and iOS. His example used a Google Spreadsheet to maintains the status of indigenous to South Africa, and using the ‘Publish as a web page”feature, he demonstrated how the Spreadsheet RSS export be used as a webservice…niffty, huh!
In this post, I’ll demonstrate how to do it using PhoneGap and XUI.
A good option to set is “Automatically republish when changes are done”.
What the function does is make a XUI XHR request to the Spreadsheets ATOM feed to read the data. It then iterates the each of the <entry> elements (each <entry> element represents a row in the Spreadsheet.
We then read each cell value (maintained in the <content> element) to build up the Header row and data row(s) and a HTML table which we then set as the document element with the id “ui_events”.