Re: Parsing XML to CoreData
Re: Parsing XML to CoreData
- Subject: Re: Parsing XML to CoreData
- From: Luther Baker <email@hidden>
- Date: Thu, 24 Mar 2011 11:51:36 -0500
I guess you could also alloc a new NSMutableString every time you enter
"didStart" ... copy will essentially be doing that for you.
If you do this - don't forget to release in "didEnd" ... or even right
before allocing - just in case you somehow break out before reaching didEnd.
-Luther
On Thu, Mar 24, 2011 at 11:24 AM, Siegfried <
email@hidden> wrote:
> On 24/03/2011, at 13:13, Hank Heijink (Mailinglists) wrote:
> > On Mar 24, 2011, at 12:06 PM, Siegfried wrote:
> >
> >> So, after discussing some methods to import and export a CoreData
> database, I ended up sticking with my initial XML idea.
> >> ...
> >
> > You need to copy currentXMLValue, because in your code, every item that
> refers to it ends up referring to the same mutable string, which will change
> every time the parser:foundCharacters: method is called.
> >
> > NSString *newValue = [currentXMLValue copy];
> > [currentEntity setValue:newValue forKey:kAttrName];
> > [newValue release];
> >
> > Assigning strings like you did works with immutable ones, but not with
> mutable ones.
>
> Ah Hank! How can I thank you?
>
> Such a simple thing but was driving me crackers.
>
> Thanks so much,
>
> Best regards,
>
> Siegfried_______________________________________________
>
> 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
>
_______________________________________________
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