GET HTML/XML PAGE - Session issue
Hello, I have a little issue with the following code :
https://gist.github.com/710861
the answer of the server is an xml without the children <placemark> where is focused my info.
try to click this link to see the tag http://www.grandecinema3.it/Cinema.axd?prov=NA&film=The+Social+Network
I think that is a problem referred to setRequestHandler and cookies.
Thanks in advance.
6 Answers
-
replace this
var dom = this.responseText.documentElement.getElementsByTagName('table')
with this
var doc = Ti.XML.parseString(xhr.responseText).documentElement; var items = doc.getElementsByTagName("Placemark");
-
[code]
Error Domain=com.google.GDataXML Code=-1 "The operation couldn’t be completed. (com.google.GDataXML error -1.)". in -[TiDOMDocumentProxy parseString:] (TiDOMDocumentProxy.m:48)
The application has crashed with an unhandled exception. Stack trace:
[/code]I just tryed before… the website don't answer with that xml structure, but with the same unless placemark tag! This is the problem..
-
solution posted here with output from log file on iPhone
-
But this is not my ouput! I have tried to paste exactly what you wrote on pastie.org but this is the output:
[INFO] Dom <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://earth.google.com/kml/2.1"> <Document><name>Cinema.kml</name><Style id="yellow"><IconStyle id="yellow-pushpin"><Icon><href>images/bollino_cinemaIN.png</href></Icon></IconStyle></Style><Style id="red"><IconStyle id="red-pushpin"><Icon><href>images/bollino_cinemaOUT.png</href></Icon></IconStyle></Style><Style id="green"><IconStyle id="green-pushpin"><Icon><href>images/bollino_cinemaIN.png</href></Icon></IconStyle></Style><Style id="white"><IconStyle id="white-pushpin"><Icon><href>images/bollino_cinemaOUT.png</href></Icon></IconStyle></Style><Style id="start"><IconStyle id="start-pushpin"><Icon><href>images/bollino_puntina.png</href></Icon></IconStyle></Style> </Document></kml> [WARN] Exception in event callback. { expressionBeginOffset = 415; expressionCaretOffset = 420; expressionEndOffset = 427; line = 12; message = "Result of expression 'items' [null] is not an object."; name = TypeError; sourceId = 237424576; sourceURL = "file://localhost/Users/alex/Desktop/TITANIUM/Grande%20Cinema%203/Resources/main/test_xhr.js"; }
-
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://earth.google.com/kml/2.1"> <Document><name>Cinema.kml</name><Style id="yellow"><IconStyle id="yellow-pushpin"><Icon><href>images/bollino_cinemaIN.png</href></Icon></IconStyle></Style><Style id="red"><IconStyle id="red-pushpin"><Icon><href>images/bollino_cinemaOUT.png</href></Icon></IconStyle></Style><Style id="green"><IconStyle id="green-pushpin"><Icon><href>images/bollino_cinemaIN.png</href></Icon></IconStyle></Style><Style id="white"><IconStyle id="white-pushpin"><Icon><href>images/bollino_cinemaOUT.png</href></Icon></IconStyle></Style><Style id="start"><IconStyle id="start-pushpin"><Icon><href>images/bollino_puntina.png</href></Icon></IconStyle></Style> </Document></kml> [WARN] Exception in event callback. { expressionBeginOffset = 415; expressionCaretOffset = 420; expressionEndOffset = 427; line = 12; message = "Result of expression 'items' [null] is not an object."; name = TypeError; sourceId = 237424576; sourceURL = "file://localhost/Users/alex/Desktop/TITANIUM/Grande%20Cinema%203/Resources/main/test_xhr.js"; }
-
I tried your code
var doc = Ti.XML.parseString(xhr.responseText).documentElement; var items = doc.getElementsByTagName("Placemark");
but the following is what I can get in the output from that page.
[INFO] One moment, building ... [INFO] Titanium SDK version: 1.4.2 [INFO] iPhone Device family: iphone [INFO] iPhone SDK version: 4.1 [INFO] Launching application in Simulator [INFO] Launched application in Simulator (0.97 seconds) [INFO] Application started [INFO] Grande Cinema 3/1.0 (1.4.2.bf53f9) [INFO] items null