#import "ObjectTesting.h" #import #import #import /* int main() { NSAutoreleasePool *arp = [NSAutoreleasePool new]; NSXMLElement *elem1 = [[NSXMLElement alloc] initWithXMLString: @"6" error: NULL]; NSXMLElement *elem2 = [[NSXMLElement alloc] initWithXMLString: @"7" error: NULL]; NSXMLElement *copy1 = [elem1 copy]; NSXMLElement *copy2 = [elem2 copy]; [copy1 setStringValue: @"7"]; PASS_EQUAL(copy1, copy2, "equal after setStringValue:"); [arp drain]; arp = nil; return 0; } */ int main() { NSAutoreleasePool *arp = [NSAutoreleasePool new]; NSXMLDocument *doc; NSXMLElement *elem; NSXMLNode *child; NSString *simpleXML = @"6"; doc = [[NSXMLDocument alloc] initWithXMLString: simpleXML options: 0 error: NULL]; PASS(doc != nil, "document was initialized from a string"); // detach the root element from its document elem = [doc rootElement]; // PASS_EQUAL([elem XMLString], simpleXML, "root element is correct"); [elem detach]; // now, simply accessing the text node child of the element leads to a CRASH // when releasing the document child = [elem childAtIndex: 0]; [doc release]; [arp release]; arp = nil; return 0; }