Skip to content

Instantly share code, notes, and snippets.

@arturoleon
Created August 9, 2014 17:51
Show Gist options
  • Save arturoleon/c29d3f39a47d93730094 to your computer and use it in GitHub Desktop.
Save arturoleon/c29d3f39a47d93730094 to your computer and use it in GitHub Desktop.
Titanium: Ejemplo lector de feeds
var xhr = Titanium.Network.createHTTPClient();
xhr.open('GET', "http://www.notisistema.com/noticias/feed/");
xhr.onload = function(e) {
var xml = this.responseXML;
if (xml === null || xml.documentElement === null) {
alert('Error. Respuesta vacia');
return;
}
var items = xml.documentElement.getElementsByTagName('item');
for (var i = 0; i < items.length; i++) {
var item = items.item(i);
$.tabla.appendRow(Ti.UI.createTableViewRow({
title: item.getElementsByTagName('title').item(0).text,
color: "black"
}));
}
};
xhr.onerror = function(e) {
alert("Error.");
console.log(e);
};
xhr.send();
function verDetalle(e) {
Alloy.createController('detalle',"Texto de noticia").getView().open();
}
$.index.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment