• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSXMLParser question about duplicate nodes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLParser question about duplicate nodes


  • Subject: Re: NSXMLParser question about duplicate nodes
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Wed, 6 Jan 2010 14:28:53 -0500

This is what I am doing now that feels like a hack (I only ever get a 2 day
forecast, the one for today is the first):

if( [elementName isEqualToString:@"yweather:forecast"]){

NSString *tmpDay = [attributeDict valueForKey:@"day"];

NSDate *now = [NSDate date];

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];

[formatter setDateFormat:@"ccc"];

NSString *dateString = [formatter stringFromDate:now];

if( [dateString isEqualToString:tmpDay]){

//today

} else {

//tomorrow

}

}

On Wed, Jan 6, 2010 at 1:34 PM, Jeremy Pereira <email@hidden> wrote:

>
> On 6 Jan 2010, at 18:13, Eric E. Dolecki wrote:
>
> Well okay yes... same element name but I need to tell them apart.
>
>
> The day attribute has a different value in each case though.  Just pull out
> the the object with the key @"day" from the attribute dictionary.
>
>
> On Wed, Jan 6, 2010 at 1:07 PM, Jeremy Pereira <email@hidden>wrote:
>
>>
>> On 6 Jan 2010, at 16:22, Eric E. Dolecki wrote:
>>
>> > I am fetching weather data & in my results I am getting today and
>> tomorrow's
>> > forecasts. However they have the same node:
>> >
>> > <yweather:forecast day="Wed" ... />
>> > <yweather:forecast day="Thu" .../>
>> >
>> > How can I get at those separately in my didStartElement? Is there a way
>> to
>> > turn that into an array or something?
>>
>> No they don't have the same node.  They are two nodes with the same
>> element name.  If both appear in  your XML they will each result in a call
>> to the parser:didStartElement:... method.
>>
>>
>> > _______________________________________________
>> >
>> > Cocoa-dev mailing list (email@hidden)
>> >
>> > Please do not post admin requests or moderator comments to the list.
>> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> >
>> > Help/Unsubscribe/Update your Subscription:
>> >
>> > This email sent to email@hidden
>>
>>
>
>
> --
> http://ericd.net
> Interactive design and development
>
>
>


--
http://ericd.net
Interactive design and development
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSXMLParser question about duplicate nodes
      • From: Philip Vallone <email@hidden>
References: 
 >NSXMLParser question about duplicate nodes (From: "Eric E. Dolecki" <email@hidden>)
 >Re: NSXMLParser question about duplicate nodes (From: "Eric E. Dolecki" <email@hidden>)
 >Re: NSXMLParser question about duplicate nodes (From: Jeremy Pereira <email@hidden>)

  • Prev by Date: Re: NSXMLParser question about duplicate nodes
  • Next by Date: Re: NSXMLParser question about duplicate nodes
  • Previous by thread: Re: NSXMLParser question about duplicate nodes
  • Next by thread: Re: NSXMLParser question about duplicate nodes
  • Index(es):
    • Date
    • Thread