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 protected]> 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 protected])
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/lutherbaker%40gmail.com
>
> This email sent to [email protected]
>
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to