• 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: referencing XML Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: referencing XML Data


  • Subject: Re: referencing XML Data
  • From: Nathan Kinsinger <email@hidden>
  • Date: Tue, 16 Sep 2008 14:27:47 -0600

On Sep 16, 2008, at 12:52 PM, Sherm Pendley wrote:

On Tue, Sep 16, 2008 at 7:39 AM, Amy Heavey <email@hidden > wrote:

NSArray *customerArray = [custdoc nodesForXPath:@".//customer" error:nil];
if ([customerArray count]){
NSXMLNode *customerNode;
for (customerNode in customerArray) {


error: parse error before 'in'

That should be:

for (NSXMLNode *customerNode in customerArray) {

The for-in statement allows both variants. Using the first version:

NSArray *myArray = [NSArray arrayWithObjects:@"one", @"two", @"three", @"four", nil];
NSString *testString = @"three";

NSString *myString = nil;
for (myString in myArray) {
if ([myString isEqualToString:testString])
break;
}
NSLog(@"myString = %@", myString);

testString = @"Five";

for (myString in myArray) {
if ([myString isEqualToString:testString])
break;
}
NSLog(@"myString = %@", myString);


myString will be valid outside of the for loop context and can be used again. Also, if it finds the testString then myString will have the found value. If the testString is not found then MyString will be nil.

--Nathan



_______________________________________________

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


References: 
 >referencing XML Data (From: Amy Heavey <email@hidden>)
 >Re: referencing XML Data (From: Nathan Kinsinger <email@hidden>)
 >Re: referencing XML Data (From: Amy Heavey <email@hidden>)
 >Re: referencing XML Data (From: "Sherm Pendley" <email@hidden>)

  • Prev by Date: Re: referencing XML Data
  • Next by Date: Re: Core data "grand-children" list
  • Previous by thread: Re: referencing XML Data
  • Next by thread: NSColorWell - What's in the corner?
  • Index(es):
    • Date
    • Thread