Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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.

— asked November 22nd 2010 by alex genovese
  • cookies
  • session
  • setrequesthandler
2 Comments
  • what platform is this? I am working on iPhone… you should tag the question appropriately

    — commented November 22nd 2010 by Aaron Saunders
  • on Iphone with Titanium 1.4.2 sdk and iphone sdk 4.1

    — commented November 23rd 2010 by alex genovese

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");
    
    — answered November 22nd 2010 by Aaron Saunders
    permalink
    0 Comments
  • [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..

    — answered November 22nd 2010 by alex genovese
    permalink
    1 Comment
    • there must be some information missing, I executed the code you have in the link and I get a response… did you replace the code "excatly" as I have listed below?

      — commented November 22nd 2010 by Aaron Saunders
  • http://pastie.org/1318887

    solution posted here with output from log file on iPhone

    — answered November 22nd 2010 by Aaron Saunders
    permalink
    1 Comment
    • Get me the same error.

      — commented November 25th 2010 by alex genovese
  • 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";
    }
    
    — answered November 23rd 2010 by alex genovese
    permalink
    0 Comments
  • 
    <?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";
    }
    
    — answered November 24th 2010 by alex genovese
    permalink
    1 Comment
    • This is the error in the output and the code that I get with your code.

      — commented November 25th 2010 by alex genovese
  • 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
    
    — answered November 25th 2010 by alex genovese
    permalink
    3 Comments
    • Pls post all you code in a pastie and I will take another look… like I said, the code I provided works fine for me, but I will take another look

      — commented November 25th 2010 by Aaron Saunders
    • any news aaron ?

      — commented November 28th 2010 by alex genovese
    • AAron sorry the issue is always present into output can you write me the titanium sdk version and that you have installed to develop please!!?

      — commented December 5th 2010 by alex genovese
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.