Apples Dirty Trick: NSXMLDocument...

Discussion in 'iOS Programming' started by DaveGee, Jul 19, 2008.

  1. macrumors 6502a

    Joined:
    Jul 25, 2001
    #1
    Just a heads up to developers who have been pouring their heart and soul into their iPhone applications and have been stuck being able to only test it using the Aspen Simulator... I might have some bad news for you...

    If you've been successfully using NSXMLDocument and have come to rely on it working just like it does in the simulator get ready for a huge let down when you discover your beloved application refuses to compile under the "iPhone" build style (as opposed to the "Aspen Simulator" build style)...

    The really frustrating part is you can't even use the 'iPhone Device' build style (and discover your program fails to compile) until you pay your 99 bucks (and ADC approves you -- and you do all the 'stuff' needed to build and test your app on the iPhone/iPod)

    Anyway, all is not a total loss.... NSXMLParser **is** included in the simulator *and* the iPhone/iPod hardware... It's not quite as simple as just stuffing your xml data into an NSXMLDocument and using all kinds of cool search methods that come along with NSXML* but its pretty much all we have to fall back on at this point... Unless you wanna try and figure out how to use libxml2 all by its lonesome.... I have a hard enough time with cocoa thank you very much and after looking at libxml2 and the kind of hoops you have to jump thu NSXMLParser was really a breeze!

    Hope this helps!

    Dave
     
  2. macrumors regular

    Joined:
    Feb 27, 2006
    Location:
    Kent, United Kingdom
    #2
    As I understand it, they removed NSXMLDocument for being too heavyweight for the iPhone. This is rather annoying as I was planning to make rather heavy use of it. XML Parser is ok for reading, but if you need to write XML then that's a no go. I guess anyone wanting to utilise a SOAP service is up the creek now.
    If you do just need to read XML, there's always this: http://code.google.com/p/touchcode/wiki/TouchXML
     
  3. thread starter macrumors 6502a

    Joined:
    Jul 25, 2001
    #3
    I don't have any problem with 'hand rolling' a SOAP request... It's really nothing more than a HTTP request with a set of commands wrapped up in an xml string. I simply use NSURLConnect and build my body (xml) by hand. Yea its messy but for the stuff I'm using it for it works okay.

    Dave
     
  4. macrumors 6502

    Joined:
    May 9, 2008
    Location:
    Bangalore
    #4
    Dave, newbie here...

    In my app i am parsing an XML from a URL by directly giving the parserObject the URL...

    But i think its better to break the statement, say...connect to URL, get Data...Parse the Data..

    So my question is how to make aHTTPConnection in the most native style, rather than NSHTTPConnection's sendSynchronousRequest (As the INSTRUMENTS showing leak in this line)

    Moreover i want to discover where the problem occurs on network failure...(whether because of connection , data miss, or..like that...

    Thanks
     
  5. macrumors newbie

    Joined:
    Jun 20, 2008
    Location:
    Phoenix, AZ
    #5
    I found TouchXML's CXMLDocument to be a perfectly suitable replacement for NSXMLDocument, but I only needed the object to be readable.

    Bill
     

Share This Page