Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Get XML source with httpclient

$
0
0

I want to get the XML from a web-service using the httpclient, but I don't how, because I want the tag name of the XML parameters

var myurl = 'url';
var aut = {
    'token': miToken,
};
 
 
var xhr = Titanium.Network.createHTTPClient();
 
xhr.onerror = function(e) {
    toast = Ti.UI.createNotification({message:"Error " + e.error});
        toast.show();
};
xhr.setTimeout(20000);
 
xhr.onload = function(e) {
    var xmlDoc = e.source;
    var dataResult = xmlDoc.documentElement.getElementsByTagName('EmpresaEntity');
    alert(dataResult.idEmp.length)
};
 
 
xhr.open('GET',myurl);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader('charset', 'utf-8');
xhr.send(aut);

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>