if (_attrs == nil || [_attrs count] == 0)
return nil;
-
- attributes = [[NSMutableDictionary alloc] init];
+
+ attributes = [[NSMutableDictionary alloc] initWithCapacity:4];
retAttrs = [[[SaxAttributes alloc] init] autorelease];
attrEnum = [_attrs objectEnumerator];
forTag:_tagName
intoAttr:&mappedAttr
intoValue:&mappedValue];
- if ((oldValue = [attributes objectForKey:mappedAttr])) {
+ if ((oldValue = [attributes objectForKey:mappedAttr]) != nil) {
NSString *val;
+
/* ZNeK: duh! */
- val = [NSString stringWithFormat:@"%@ %@",oldValue, mappedValue];
+ // TODO: hh asks: what does 'duh' is supposed to mean?
+ val = [[NSString alloc] initWithFormat:@"%@ %@",oldValue, mappedValue];
[attributes setObject:val forKey:mappedAttr];
+ [val release];
}
else
[attributes setObject:mappedValue forKey:mappedAttr];
attrEnum = [attributes keyEnumerator];
while ((curAttr = [attrEnum nextObject]) != nil) {
+ /*
+ TODO: values are not always mapped to CDATA! Eg in the dawson draft:
+ | TYPE for TEL | tel.type | NMTOKENS | 'VOICE' |
+ | TYPE for EMAIL | email.type | NMTOKENS | 'INTERNET' |
+ | TYPE for PHOTO,| img.type | CDATA | REQUIRED |
+ | and LOGO | | | |
+ | TYPE for SOUND | aud.type | CDATA | REQUIRED |
+ | VALUE | value | NOTATION | See elements |
+ */
+
[retAttrs addAttribute:curAttr uri:self->prefixURI rawName:curAttr
type:@"CDATA" value:[attributes objectForKey:curAttr]];
}