Created
August 9, 2014 17:51
-
-
Save arturoleon/c29d3f39a47d93730094 to your computer and use it in GitHub Desktop.
Titanium: Ejemplo lector de feeds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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