@@ -126,16 +126,10 @@ [attribute->ns release]; attribute->ns = [attributeNS retain]; } @implementation OFXMLParser -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) -@synthesize processingInstructionsHandler, elementStartHandler; -@synthesize elementEndHandler, charactersHandler, CDATAHandler, commentHandler; -@synthesize unknownEntityHandler; -#endif - + (void)initialize { size_t i; const SEL selectors_[] = { @@ -217,18 +211,10 @@ [namespaces release]; [attributes release]; [attributeName release]; [attributePrefix release]; [previous release]; -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) - [elementStartHandler release]; - [elementEndHandler release]; - [charactersHandler release]; - [CDATAHandler release]; - [commentHandler release]; - [unknownEntityHandler release]; -#endif [super dealloc]; } - (id )delegate @@ -332,17 +318,12 @@ OFAutoreleasePool *pool; pool = [[OFAutoreleasePool alloc] init]; characters = transform_string(cache, 0, YES, self); -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) - if (charactersHandler != NULL) - charactersHandler(self, characters); - else -#endif - [delegate parser: self - foundCharacters: characters]; + [delegate parser: self + foundCharacters: characters]; [pool release]; } [cache removeNItems: [cache count]]; @@ -563,31 +544,21 @@ [OFUnboundNamespaceException newWithClass: isa prefix: prefix]; pool2 = [[OFAutoreleasePool alloc] init]; -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) - if (elementStartHandler != NULL) - elementStartHandler(self, name, prefix, ns, nil); - else -#endif - [delegate parser: self - didStartElement: name - withPrefix: prefix - namespace: ns - attributes: nil]; + [delegate parser: self + didStartElement: name + withPrefix: prefix + namespace: ns + attributes: nil]; if (buffer[*i] == '/') { -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) - if (elementEndHandler != NULL) - elementEndHandler(self, name, prefix, ns); - else -#endif - [delegate parser: self - didEndElement: name - withPrefix: prefix - namespace: ns]; + [delegate parser: self + didEndElement: name + withPrefix: prefix + namespace: ns]; if ([previous count] == 0) finishedParsing = YES; } else [previous addObject: cacheString]; @@ -664,19 +635,14 @@ ns = namespace_for_prefix(prefix, namespaces); if (prefix != nil && ns == nil) @throw [OFUnboundNamespaceException newWithClass: isa prefix: prefix]; -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) - if (elementEndHandler != NULL) - elementEndHandler(self, name, prefix, ns); - else -#endif - [delegate parser: self - didEndElement: name - withPrefix: prefix - namespace: ns]; + [delegate parser: self + didEndElement: name + withPrefix: prefix + namespace: ns]; [pool release]; [namespaces removeLastObject]; [name release]; @@ -727,31 +693,21 @@ resolve_attribute_namespace(attributesCArray[j], namespaces, isa); pool = [[OFAutoreleasePool alloc] init]; -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) - if (elementStartHandler != NULL) - elementStartHandler(self, name, prefix, ns, attributes); - else -#endif - [delegate parser: self - didStartElement: name - withPrefix: prefix - namespace: ns - attributes: attributes]; + [delegate parser: self + didStartElement: name + withPrefix: prefix + namespace: ns + attributes: attributes]; if (buffer[*i] == '/') { -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) - if (elementEndHandler != NULL) - elementEndHandler(self, name, prefix, ns); - else -#endif - [delegate parser: self - didEndElement: name - withPrefix: prefix - namespace: ns]; + [delegate parser: self + didEndElement: name + withPrefix: prefix + namespace: ns]; if ([previous count] == 0) finishedParsing = YES; [namespaces removeLastObject]; @@ -984,17 +940,12 @@ pool = [[OFAutoreleasePool alloc] init]; cache_append(cache, buffer + *last, encoding, *i - *last); CDATA = transform_string(cache, 2, NO, nil); -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) - if (CDATAHandler != NULL) - CDATAHandler(self, CDATA); - else -#endif - [delegate parser: self - foundCDATA: CDATA]; + [delegate parser: self + foundCDATA: CDATA]; [pool release]; [cache removeNItems: [cache count]]; @@ -1043,17 +994,12 @@ pool = [[OFAutoreleasePool alloc] init]; cache_append(cache, buffer + *last, encoding, *i - *last); comment = transform_string(cache, 2, NO, nil); -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) - if (commentHandler != NULL) - commentHandler(self, comment); - else -#endif - [delegate parser: self - foundComment: comment]; + [delegate parser: self + foundComment: comment]; [pool release]; [cache removeNItems: [cache count]]; @@ -1096,15 +1042,10 @@ } - (OFString*)string: (OFString*)string containsUnknownEntityNamed: (OFString*)entity { -#if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) - if (unknownEntityHandler != NULL) - return unknownEntityHandler(self, entity); -#endif - return [delegate parser: self foundUnknownEntityNamed: entity]; } @end