Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 6, 2009, 10:43 PM   #1
XcodeNewb
macrumors member
 
Join Date: Feb 2009
iPhone XML Parser Help - Unique

Ok, I know there are a lot of parser examples and I have been through them all. I thought I had it figured out until I realized that some of the data I need is actually in the tag of one of the elements.

Here is an example. I need the price read in here but also the url link. I am using the simple xml process with the didStartElement, didEndElement and the foundCharacters methods. These methods find the price tag and read the data ( i.e. 250 ) but I cannot get the url from this tag. Any ideas?

Thanks in advance. I am learning as I go. I hope the code displays correctly.

Code:
  <trips>
    <trip>
      <price url="/bookmeToday/code=0-ICtL5lnamzyrp29sDFqq.sJJWXUydEzy5W1k_q2v7.3-5iP1kAlP_y6jYWhQXUR.F.UA.25770.0&amp;_sid_=3-5iP1kAlP_y6jYWhQXUR" currency="USD">$250</price>
      <more>More data here</more>
      <evenmore>Even more data</evenmore>
    </trip>
  </trips>
XcodeNewb is offline   0 Reply With Quote
Old Feb 7, 2009, 01:16 AM   #2
kalimba
macrumors regular
 
Join Date: Jun 2008
The data that you're looking for (the 'url' and 'currency' attributes of the 'price' element) is sent to you in the parser:didStartElement:namespaceURI:qualifiedName:attributes: callback. The 'attributes:' parameter is an NSDictionary * that contains key-value pairs for the attributes of the element.

Check the Apple docs for an example:
https://developer.apple.com/iphone/l...002265-1001969
kalimba is offline   0 Reply With Quote
Old Feb 7, 2009, 07:29 AM   #3
XcodeNewb
Thread Starter
macrumors member
 
Join Date: Feb 2009
Great answer

Thanks kalimba. I will try this out this afternoon and let you know how it goes. Thanks for taking the time to help.
XcodeNewb is offline   0 Reply With Quote
Old Feb 7, 2009, 08:22 AM   #4
XcodeNewb
Thread Starter
macrumors member
 
Join Date: Feb 2009
Great

Thanks again kalimba. Example worked great and took about 30 seconds to do. Thanks again
XcodeNewb is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Iphone 3G need help asap!! iphonebabe iPhone 0 Jan 15, 2011 10:45 AM
iphone 3gs jailbrake help iphone3gs.ash Jailbreaks and iOS Hacks 3 Nov 11, 2010 10:05 AM
iPhone App Testing Help? jonclarkccnp iPhone and iPod touch Apps 3 Nov 11, 2010 08:21 AM
iPhone 3g unlock help! - "No sim card installed" fsikdernyc Jailbreaks and iOS Hacks 15 May 23, 2010 05:23 PM
Transmission Help - Unique Problem b0b4f377 Mac Applications and Mac App Store 7 Nov 3, 2009 10:43 AM


All times are GMT -5. The time now is 05:28 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC