My Core Data app is throwing an exception when reading in the XML
data store at launch. This exception only happens when a string
attribute of one of my Core Data objects contains "<" which is a
legal XML entity AFAIK. This entity was created by Core Data when I
stored an HTML string. If I edit the XML file and remove the XML
entities, no exception.
When I created a test app using an identical model-defined Core Data
Entity, the same HTML string containing the <" XML entities loads
with no exception. For some reason, the issue is not reproduced.
Any suggestions? I'm considering storing the HTML as NSData as a
workaround, but it would be nice to make sense of this instead.
2007-10-22 16:57:52.378 Enclose[14387] NSExceptionHandler has
recorded the following exception:
NSInvalidArgumentException -- Attempt to mutate immutable object with
appendString:
(gdb) bt
#0 0x92bfe014 in -[NSException raise] ()
#1 0x92bfde68 in +[NSException raise:format:] ()
#2 0x92cc6364 in mutateError ()
#3 0x92bca20c in -[NSCFString appendString:] ()
#4 0x92c27c3c in -[NSXMLTreeReader processText:] ()
#5 0x92c24a04 in -[NSXMLTreeReader parse] ()
#6 0x92c240b8 in -[NSXMLDocument initWithData:options:error:] ()
#7 0x92d30858 in -[NSXMLDocument
initWithContentsOfURL:options:error:] ()
#8 0x94181114 in -[NSXMLObjectStore
initWithRootStore:configurationName:options:url:] ()
#9 0x941674d4 in -[NSPersistentStoreCoordinator
addPersistentStoreWithType:configuration:URL:options:error:] ()
#10 0x00008320 in -[GSApp persistentStoreCoordinator]
(self=0x16509b0, _cmd=0x90aa651c) at /Users/paul/Gray/Projects/
Enclose/dev/Enclose/GSApp.m:735
#11 0x00008418 in -[GSApp managedObjectContext] (self=0x16509b0,
_cmd=0x90aa15d4) at /Users/paul/Gray/Projects/Enclose/dev/Enclose/
GSApp.m:751
#12 0x92c402ac in _NSGetUsingKeyValueGetter ()
#13 0x92bf2e6c in -[NSObject(NSKeyValueCoding) valueForKeyPath:] ()
#14 0x939cc0cc in -[NSBinder
_valueForKeyPath:ofObject:mode:raisesForNotApplicableKeys:] ()
#15 0x939cbd68 in -[NSBinder
valueForBinding:resolveMarkersToPlaceholders:] ()
#16 0x93c669a8 in -[NSObjectParameterBinder
_updateObject:observedController:observedKeyPath:context:] ()
#17 0x939c3c44 in -[NSObject(NSKeyValueBindingCreation)
bind:toObject:withKeyPath:options:] ()
#18 0x937bb9e8 in -[NSIBObjectData
nibInstantiateWithOwner:topLevelObjects:] ()
#19 0x937a7c9c in loadNib ()
#20 0x937a76f4 in +[NSBundle(NSNibLoading)
_loadNibFile:nameTable:withZone:ownerBundle:] ()
#21 0x937febc4 in +[NSBundle(NSNibLoading)
loadNibFile:externalNameTable:withZone:] ()
#22 0x9388ea70 in +[NSBundle(NSNibLoading) loadNibNamed:owner:] ()
#23 0x9388e810 in NSApplicationMain ()
#24 0x00002b78 in main (argc=1, argv=0xbffff5dc) at /Users/paul/Gray/
Projects/Enclose/dev/Enclose/main.m:13
Here's my customized version of the Core Data (non-document) template
method where the exception is thrown (near the end):