View Full Version : Best way to read In weather XML from weather.gov?

15 Mar 2011, 5:46 AM

I'm trying to cobble together a simple weather checking app using Sencha Touch and am hitting a wall trying to read XML generated by weather.gov's REST api. For now, I'm just trying to get my app to read XML generated by a query offered on their documentation page (http://www.weather.gov/forecasts/xml/rest.php):


They don't provide a way to add a callback param, so I'm left using a ScriptTag proxy. However, when the app loads and the xml is to be added to the page, I get this error in the console:

Uncaught SyntaxError: Unexpected token <

Because of the <dwml opening tag. The proxy is configured to use an XMLReader to parse (I'll include my CoffeeScript pseudocode below), but I'm not sure what to do at this point. Is there a better proxy to use, or a particular way to configure the XMLReader to parse this?

Thanks for any help. Here's what my store looks like:

app.stores.weatherconditions = new Ext.data.Store
model: 'WeatherCondition'
type: 'scripttag'
url: '(the url from above)'
type: 'xml'
root: 'head'


15 Mar 2011, 2:13 PM
In the sencha examples, there's an example that uses JSONP to pull weather data from another site - maybe you should look at how its done there.

Go here:

Then click on Data > JSON P