mrbrandbart
mrbrandbart

Reputation: 63

Fetching data from external XML with Alloy in Titanium

I'm working on my very first iPhone application made in Appcelerator Titanium. I'm using the Alloy framework.

I only have a general JavaScript background. I Have read up on how BackboneJS works, however I am struggling with the concept.

The app is very basic, all I need is to fetch an URL which contains a XML response. Example: http://www.domain.com/api.php?listProducts

This URL will respons something like this

<response>
<request>
<timestamp id="0.66266400 1357656226"/>
<status id="100">OK</status>
</request>
<api_function>getproductsimage</api_function>
<products>
<product id="1">
<images>
<image name="featured" width="640" height="347" src="../html/productImages/featured.jpg"/>
<image name="nonretina" width="125" height="95" src="../html/productImages/thumbnail.jpg"/>
<image name="retina" width="250" height="190" src="../html/productImages/thumbnail.jpg"/>
<image name="ldpi" width="" height="" src=""/>
<image name="mdpi" width="" height="" src=""/>
<image name="hdpi" width="" height="" src=""/>
<image name="xhdpi" width="" height="" src=""/>
</images>
</product>
</product>
</products>
</response>

I want to handle this data in a TableView and obviously there will be more than one response. However I don't really understand the documentation about making an XHR in BackboneJS. Would anyone be able to help me make a simple collection / model for simply fetching this URL and displaying the data.

Thanks in advance

Upvotes: 1

Views: 1321

Answers (1)

Aaron Saunders
Aaron Saunders

Reputation: 33345

is is purely a backbonejs Model parse issue since backbone works with JSON responses and you are looking at return XML.

There is no requirement that you use Alloy models to solve this problem so you can just implement your solution with http requests and populate the objects yourself.

Upvotes: 1

Related Questions