Overview
Comment: | Fix namespace handling in OFXMLElement.
Although it was originally decided not to backport this to 0.5, the |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | 0.5 |
Files: | files | file ages | folders |
SHA3-256: |
21bd46e17a35d8f83b3e17cc416851fa |
User & Date: | js on 2011-05-14 20:00:48 |
Other Links: | branch diff | manifest | tags |
Context
2011-05-14
| ||
23:26 | Correctly check the length in of_string_check_utf8. check-in: 1c2f416cb9 user: js tags: 0.5 | |
20:00 | Fix namespace handling in OFXMLElement. check-in: 21bd46e17a user: js tags: 0.5 | |
19:50 | Ignore whitespaces around the root element in -[initWithXMLString]. check-in: 46056b5fa1 user: js tags: 0.5 | |
Changes
Modified src/OFXMLElement.h from [11b7a22a69] to [f4d50f39b5].
︙ | ︙ | |||
323 324 325 326 327 328 329 | * \param prefix The prefix for the namespace * \param ns The namespace for which the prefix is bound */ - (void)bindPrefix: (OFString*)prefix forNamespace: (OFString*)ns; /** | | | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | * \param prefix The prefix for the namespace * \param ns The namespace for which the prefix is bound */ - (void)bindPrefix: (OFString*)prefix forNamespace: (OFString*)ns; /** * Sets the default namespace for the element to be used if there is no parent. * * \param ns The default namespace for the element */ - (void)setDefaultNamespace: (OFString*)ns; /** * Adds a child to the OFXMLElement. |
︙ | ︙ |
Modified src/OFXMLElement.m from [6fd40e1ec7] to [2e27de79cd].
︙ | ︙ | |||
365 366 367 368 369 370 371 | * -[copy] is called. */ str->isa = [OFString class]; return str; } pool = [[OFAutoreleasePool alloc] init]; | < < < > > > > > > > | < < | < | < < | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | * -[copy] is called. */ str->isa = [OFString class]; return str; } pool = [[OFAutoreleasePool alloc] init]; if (parent != nil && parent->namespaces != nil) { OFEnumerator *key_enum = [namespaces keyEnumerator]; OFEnumerator *obj_enum = [namespaces objectEnumerator]; id key, obj; all_namespaces = [[parent->namespaces mutableCopy] autorelease]; while ((key = [key_enum nextObject]) != nil && (obj = [obj_enum nextObject]) != nil) [all_namespaces setObject: obj forKey: key]; } else all_namespaces = namespaces; prefix = [all_namespaces objectForKey: (ns != nil ? ns : (OFString*)@"")]; parent_prefix = [all_namespaces objectForKey: (parent != nil && parent->ns != nil ? parent->ns : (OFString*)@"")]; if (parent != nil && parent->ns != nil && parent_prefix == nil) def_ns = parent->ns; else if (parent != nil && parent->defaultNamespace != nil) def_ns = parent->defaultNamespace; else def_ns = defaultNamespace; i = 0; len = [name cStringLength] + 3; str_c = [self allocMemoryWithSize: len]; /* Start of tag */ str_c[i++] = '<'; if (prefix != nil && ![ns isEqual: def_ns]) { len += [prefix cStringLength] + 1; @try { str_c = [self resizeMemory: str_c toSize: len]; } @catch (id e) { [self freeMemory: str_c]; @throw e; } memcpy(str_c + i, [prefix cString], [prefix cStringLength]); i += [prefix cStringLength]; str_c[i++] = ':'; } memcpy(str_c + i, [name cString], [name cStringLength]); i += [name cStringLength]; /* xmlns if necessary */ if (prefix == nil && ((ns != nil && ![ns isEqual: def_ns]) || (ns == nil && def_ns != nil))) { len += [ns cStringLength] + 9; @try { str_c = [self resizeMemory: str_c toSize: len]; } @catch (id e) { [self freeMemory: str_c]; @throw e; } memcpy(str_c + i, " xmlns='", 8); i += 8; memcpy(str_c + i, [ns cString], [ns cStringLength]); i += [ns cStringLength]; str_c[i++] = '\''; } /* Attributes */ attrs_carray = [attributes cArray]; attrs_count = [attributes count]; pool2 = [[OFAutoreleasePool alloc] init]; |
︙ | ︙ |