[Request] XML Parse from online source

Discussion in 'iOS Development' started by JoshuaCaputo, Mar 1, 2010.

  1. JoshuaCaputo

    JoshuaCaputo New Member

    Joined:
    Aug 2, 2008
    Messages:
    605
    Likes Received:
    0
    Device:
    iPod touch
    Skylar?

    Please Register or Log in to view images



    Hey guys,

    I have been struggling with a way to parse the data in an XML file from an online source. I know how to get the file into play

    Code:
    	
    NSString *leaderboardServiceURL = @"http://www.dynamix-dev.com/mySQL/mapInfo.xml";
    NSURL *url=[[NSURL alloc] initWithString:leaderboardServiceURL];
    NSString *results = [[NSString alloc] initWithContentsOfURL:url]; 
    NSLog(@"%@", results);
    But I can't figure out how to load a certain value.

    Anyone got a tutorial for me?

    Thanks
  2. lauNchD

    lauNchD Well-Known Member

    Joined:
    Jan 27, 2008
    Messages:
    1,844
    Likes Received:
    261
    Device:
    iPhone 5 (Black)
    NSXMLParser is probably the easiest way to parse it in a flexible, non-hardcoded way. I don't know about any tutorials (maybe the earthquake app from the SDK examples, though), but it should be relatively easy to implement.
  3. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    NSXMLParser is a memory-muncher compared to the C libxml2 parser. That's something to think about for the iPhone. However, if the file is small, and you don't need to parse too much data, the Cocoa solution is fine.

    I don't know of any tutorials though.
  4. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
  5. NolesFans

    NolesFans New Member

    Joined:
    Sep 23, 2008
    Messages:
    404
    Likes Received:
    0
    Device:
    iPod touch
    I use libxml2 for XML Parsers.

Share This Page