Comment: | OFXMLElement: Remove defaultNamespace property |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
eed200181b72cc50f00a3dd51268f6fc |
User & Date: | js on 2022-09-04 13:17:27 |
Other Links: | manifest | tags |
2022-09-04
| ||
18:27 | Remove -[OFString stringByPrependingString:] check-in: 114576fe94 user: js tags: trunk | |
13:17 | OFXMLElement: Remove defaultNamespace property check-in: eed200181b user: js tags: trunk | |
2022-08-30
| ||
01:34 | OFStream: readTillDelimiter -> readUntilDelimiter check-in: 30492a6b61 user: js tags: trunk | |
Modified src/OFXMLAttribute.h from [facd4b4e2b] to [894be32117].
︙ | ︙ | |||
87 88 89 90 91 92 93 | * @param name The name of the attribute * @param nameSpace The namespace of the attribute * @param stringValue The string value of the attribute * @return An initialized OFXMLAttribute with the specified parameters */ - (instancetype)initWithName: (OFString *)name namespace: (nullable OFString *)nameSpace | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 | * @param name The name of the attribute * @param nameSpace The namespace of the attribute * @param stringValue The string value of the attribute * @return An initialized OFXMLAttribute with the specified parameters */ - (instancetype)initWithName: (OFString *)name namespace: (nullable OFString *)nameSpace stringValue: (OFString *)stringValue OF_DESIGNATED_INITIALIZER; - (instancetype)initWithSerialization: (OFXMLElement *)element; @end OF_ASSUME_NONNULL_END |
Modified src/OFXMLAttribute.m from [f2a6cbc394] to [fef93ca0aa].
︙ | ︙ | |||
66 67 68 69 70 71 72 | } return self; } - (instancetype)initWithSerialization: (OFXMLElement *)element { | | > | | | | | | > > > | > > > > > > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | } return self; } - (instancetype)initWithSerialization: (OFXMLElement *)element { void *pool; OFString *name, *namespace, *stringValue; @try { pool = objc_autoreleasePoolPush(); if (![element.name isEqual: self.className] || ![element.namespace isEqual: OFSerializationNS]) @throw [OFInvalidArgumentException exception]; name = [element attributeForName: @"name"].stringValue; namespace = [element attributeForName: @"namespace"] .stringValue; stringValue = [element attributeForName: @"stringValue"] .stringValue; } @catch (id e) { [self release]; @throw e; } self = [self initWithName: name namespace: namespace stringValue: stringValue]; @try { objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } return self; |
︙ | ︙ | |||
174 175 176 177 178 179 180 | objc_autoreleasePoolPop(pool); return [element autorelease]; } - (OFString *)description { | | | > | | 184 185 186 187 188 189 190 191 192 193 194 195 196 | objc_autoreleasePoolPop(pool); return [element autorelease]; } - (OFString *)description { return [OFString stringWithFormat: @"<%@: name=%@, namespace=%@, " @"stringValue=%@>", self.class, _name, _namespace, _stringValue]; } @end |
Modified src/OFXMLCDATA.m from [53038bdcd2] to [268b8de778].
︙ | ︙ | |||
112 113 114 115 116 117 118 | OFString *ret = [OFString stringWithFormat: @"<![CDATA[%@]]>", tmp]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } | < < < < < < < < < < < | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | OFString *ret = [OFString stringWithFormat: @"<![CDATA[%@]]>", tmp]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } - (OFString *)description { return self.XMLString; } - (OFXMLElement *)XMLElementBySerializing { |
︙ | ︙ |
Modified src/OFXMLCharacters.m from [9ea4b56013] to [53e16f06bf].
︙ | ︙ | |||
104 105 106 107 108 109 110 | } - (OFString *)XMLString { return _characters.stringByXMLEscaping; } | < < < < < < < < < < < | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | } - (OFString *)XMLString { return _characters.stringByXMLEscaping; } - (OFString *)description { return self.XMLString; } - (OFXMLElement *)XMLElementBySerializing { return [OFXMLElement elementWithName: self.className namespace: OFSerializationNS stringValue: _characters]; } @end |
Modified src/OFXMLComment.m from [842e736751] to [9e48182a96].
︙ | ︙ | |||
101 102 103 104 105 106 107 | } - (OFString *)XMLString { return [OFString stringWithFormat: @"<!--%@-->", _text]; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | } - (OFString *)XMLString { return [OFString stringWithFormat: @"<!--%@-->", _text]; } - (OFString *)description { return self.XMLString; } - (OFXMLElement *)XMLElementBySerializing { return [OFXMLElement elementWithName: self.className namespace: OFSerializationNS stringValue: _text]; } @end |
Modified src/OFXMLElement.h from [76f1b54ce7] to [03aa33631b].
︙ | ︙ | |||
28 29 30 31 32 33 34 | /** * @class OFXMLElement OFXMLElement.h ObjFW/OFXMLElement.h * * @brief A class which stores an XML element. */ @interface OFXMLElement: OFXMLNode { | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | /** * @class OFXMLElement OFXMLElement.h ObjFW/OFXMLElement.h * * @brief A class which stores an XML element. */ @interface OFXMLElement: OFXMLNode { OFString *_name, *_Nullable _namespace; OFMutableArray OF_GENERIC(OFXMLAttribute *) *_Nullable _attributes; OFMutableDictionary OF_GENERIC(OFString *, OFString *) *_Nullable _namespaces; OFMutableArray OF_GENERIC(OFXMLNode *) *_Nullable _children; OF_RESERVE_IVARS(OFXMLElement, 4) } |
︙ | ︙ | |||
51 52 53 54 55 56 57 | #ifndef __cplusplus @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFString *namespace; #else @property OF_NULLABLE_PROPERTY (copy, nonatomic, getter=namespace, setter=setNamespace:) OFString *nameSpace; #endif | < < < < < < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #ifndef __cplusplus @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFString *namespace; #else @property OF_NULLABLE_PROPERTY (copy, nonatomic, getter=namespace, setter=setNamespace:) OFString *nameSpace; #endif /** * @brief An array with the attributes of the element. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFArray OF_GENERIC(OFXMLAttribute *) *attributes; /** |
︙ | ︙ | |||
325 326 327 328 329 330 331 | - (void)removeChild: (OFXMLNode *)child; /** * @brief Removes the child at the specified index. * * @param index The index of the child to remove */ | < > | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | - (void)removeChild: (OFXMLNode *)child; /** * @brief Removes the child at the specified index. * * @param index The index of the child to remove */ - (void)removeChildAtIndex: (size_t)index; /** * @brief Replaces the first child that is equal to the specified OFXMLNode * with the specified node. * * @param child The child to replace * @param node The node to replace the child with */ |
︙ | ︙ | |||
349 350 351 352 353 354 355 | - (void)replaceChildAtIndex: (size_t)index withNode: (OFXMLNode *)node; /** * @brief Returns all children that have the specified namespace. * * @return All children that have the specified namespace */ | | | | | | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | - (void)replaceChildAtIndex: (size_t)index withNode: (OFXMLNode *)node; /** * @brief Returns all children that have the specified namespace. * * @return All children that have the specified namespace */ - (OFArray OF_GENERIC(OFXMLElement *) *) elementsForNamespace: (nullable OFString *)elementNS; /** * @brief Returns the first child element with the specified name. * * @param elementName The name of the element * @return The first child element with the specified name */ - (nullable OFXMLElement *)elementForName: (OFString *)elementName; /** * @brief Returns the child elements with the specified name. * * @param elementName The name of the elements * @return The child elements with the specified name */ - (OFArray OF_GENERIC(OFXMLElement *) *) elementsForName: (OFString *)elementName; /** * @brief Returns the first child element with the specified name and namespace. * * @param elementName The name of the element * @param elementNS The namespace of the element * @return The first child element with the specified name and namespace |
︙ | ︙ | |||
389 390 391 392 393 394 395 396 397 398 399 400 | * @param elementName The name of the elements * @param elementNS The namespace of the elements * @return The child elements with the specified name and namespace */ - (OFArray OF_GENERIC(OFXMLElement *) *) elementsForName: (OFString *)elementName namespace: (nullable OFString *)elementNS; @end OF_ASSUME_NONNULL_END #import "OFXMLElement+Serialization.h" | > > > > > > > > > > > > > > > > > > > > > > | 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 | * @param elementName The name of the elements * @param elementNS The namespace of the elements * @return The child elements with the specified name and namespace */ - (OFArray OF_GENERIC(OFXMLElement *) *) elementsForName: (OFString *)elementName namespace: (nullable OFString *)elementNS; /** * @brief Returns an OFString representing the OFXMLElement as an XML string * with the specified indentation per level. * * @param indentation The indentation per level * @return An OFString representing the OFXMLNode as an XML string with * indentation */ - (OFString *)XMLStringWithIndentation: (unsigned int)indentation; /** * @brief Returns an OFString representing the OFXMLElement as an XML string * with the specified default namespace and indentation per level. * * @param defaultNS The default namespace * @param indentation The indentation per level * @return An OFString representing the OFXMLNode as an XML string with * indentation */ - (OFString *)XMLStringWithDefaultNamespace: (OFString *)defaultNS indentation: (unsigned int)indentation; @end OF_ASSUME_NONNULL_END #import "OFXMLElement+Serialization.h" |
Modified src/OFXMLElement.m from [19e272e9d6] to [ada192cadd].
︙ | ︙ | |||
69 70 71 72 73 74 75 | [super dealloc]; } @end @implementation OFXMLElement @synthesize name = _name, namespace = _namespace; | < | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | [super dealloc]; } @end @implementation OFXMLElement @synthesize name = _name, namespace = _namespace; + (instancetype)elementWithName: (OFString *)name { return [[[self alloc] initWithName: name] autorelease]; } + (instancetype)elementWithName: (OFString *)name |
︙ | ︙ | |||
207 208 209 210 211 212 213 | @throw e; } self = [self initWithName: element->_name namespace: element->_namespace]; @try { | < < | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | @throw e; } self = [self initWithName: element->_name namespace: element->_namespace]; @try { [_attributes release]; _attributes = [element->_attributes retain]; [_namespaces release]; _namespaces = [element->_namespaces retain]; [_children release]; _children = [element->_children retain]; |
︙ | ︙ | |||
261 262 263 264 265 266 267 | @throw e; } self = [self initWithName: element->_name namespace: element->_namespace]; @try { | < < | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | @throw e; } self = [self initWithName: element->_name namespace: element->_namespace]; @try { [_attributes release]; _attributes = [element->_attributes retain]; [_namespaces release]; _namespaces = [element->_namespaces retain]; [_children release]; _children = [element->_children retain]; |
︙ | ︙ | |||
307 308 309 310 311 312 313 | @try { OFXMLElement *attributesElement, *namespacesElement; OFXMLElement *childrenElement; OFEnumerator *keyEnumerator, *objectEnumerator; OFString *key, *object; | < < < < < | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | @try { OFXMLElement *attributesElement, *namespacesElement; OFXMLElement *childrenElement; OFEnumerator *keyEnumerator, *objectEnumerator; OFString *key, *object; attributesElement = [[element elementForName: @"attributes" namespace: OFSerializationNS] elementsForNamespace: OFSerializationNS].firstObject; namespacesElement = [[element elementForName: @"namespaces" namespace: OFSerializationNS] |
︙ | ︙ | |||
386 387 388 389 390 391 392 | return self; } - (void)dealloc { [_name release]; [_namespace release]; | < | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | return self; } - (void)dealloc { [_name release]; [_namespace release]; [_attributes release]; [_namespaces release]; [_children release]; [super dealloc]; } |
︙ | ︙ | |||
443 444 445 446 447 448 449 | } [ret makeImmutable]; return ret; } | | | | | | < < < < < < < < < < < < < | | | < > > | | | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | } [ret makeImmutable]; return ret; } - (OFString *)of_XMLStringWithDefaultNS: (OFString *)defaultNS namespaces: (OFDictionary *)allNS indentation: (unsigned int)indentation level: (unsigned int)level OF_DIRECT { void *pool; char *cString; size_t length, i; OFString *prefix, *ret; pool = objc_autoreleasePoolPush(); /* Add the namespaces of the current element */ if (allNS != nil) { OFEnumerator *keyEnumerator = [_namespaces keyEnumerator]; OFEnumerator *objectEnumerator = [_namespaces objectEnumerator]; OFMutableDictionary *tmp; OFString *key, *object; tmp = [[allNS mutableCopy] autorelease]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) [tmp setObject: object forKey: key]; allNS = tmp; } else allNS = _namespaces; prefix = [allNS objectForKey: (_namespace != nil ? _namespace : (OFString *)@"")]; i = 0; length = _name.UTF8StringLength + 3 + (level * indentation); cString = OFAllocMemory(length, 1); @try { memset(cString + i, ' ', level * indentation); i += level * indentation; /* Start of tag */ cString[i++] = '<'; if (prefix.length > 0) { length += prefix.UTF8StringLength + 1; cString = OFResizeMemory(cString, length, 1); memcpy(cString + i, prefix.UTF8String, prefix.UTF8StringLength); i += prefix.UTF8StringLength; cString[i++] = ':'; } memcpy(cString + i, _name.UTF8String, _name.UTF8StringLength); i += _name.UTF8StringLength; /* xmlns if necessary */ if (prefix.length == 0 && defaultNS != _namespace && ![defaultNS isEqual: _namespace]) { length += _namespace.UTF8StringLength + 9; cString = OFResizeMemory(cString, length, 1); memcpy(cString + i, " xmlns='", 8); i += 8; memcpy(cString + i, _namespace.UTF8String, _namespace.UTF8StringLength); i += _namespace.UTF8StringLength; cString[i++] = '\''; defaultNS = _namespace; } /* Attributes */ for (OFXMLAttribute *attribute in _attributes) { void *pool2 = objc_autoreleasePoolPush(); const char *attributeNameCString = attribute->_name.UTF8String; size_t attributeNameLength = attribute->_name.UTF8StringLength; OFString *attributePrefix = nil; OFString *tmp = attribute.stringValue.stringByXMLEscaping; char delimiter = (attribute->_useDoubleQuotes ? '"' : '\''); if (attribute->_namespace != nil && [(attributePrefix = [allNS objectForKey: attribute->_namespace]) length] == 0) @throw [OFUnboundNamespaceException exceptionWithNamespace: attribute.namespace element: self]; length += attributeNameLength + (attributePrefix != nil ? attributePrefix.UTF8StringLength + 1 : 0) + tmp.UTF8StringLength + 4; |
︙ | ︙ | |||
601 602 603 604 605 606 607 | unsigned int ind = (indent ? indentation : 0); if (ind) [tmp addItem: "\n"]; if ([child isKindOfClass: [OFXMLElement class]]) childString = [(OFXMLElement *)child | | | | | > | | < > | | > | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | unsigned int ind = (indent ? indentation : 0); if (ind) [tmp addItem: "\n"]; if ([child isKindOfClass: [OFXMLElement class]]) childString = [(OFXMLElement *)child of_XMLStringWithDefaultNS: defaultNS namespaces: allNS indentation: ind level: level + 1]; else { childString = child.XMLString; for (unsigned int j = 0; j < ind * (level + 1); j++) [tmp addItem: " "]; } [tmp addItems: childString.UTF8String count: childString.UTF8StringLength]; } if (indent) [tmp addItem: "\n"]; |
︙ | ︙ | |||
634 635 636 637 638 639 640 | if (indent) { memset(cString + i, ' ', level * indentation); i += level * indentation; } cString[i++] = '<'; cString[i++] = '/'; | | | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | if (indent) { memset(cString + i, ' ', level * indentation); i += level * indentation; } cString[i++] = '<'; cString[i++] = '/'; if (prefix.length > 0) { length += prefix.UTF8StringLength + 1; cString = OFResizeMemory(cString, length, 1); memcpy(cString + i, prefix.UTF8String, prefix.UTF8StringLength); i += prefix.UTF8StringLength; cString[i++] = ':'; |
︙ | ︙ | |||
664 665 666 667 668 669 670 | OFFreeMemory(cString); } return ret; } - (OFString *)XMLString { | | | | | | | | | | | | | | | < < < < | 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | OFFreeMemory(cString); } return ret; } - (OFString *)XMLString { return [self of_XMLStringWithDefaultNS: nil namespaces: nil indentation: 0 level: 0]; } - (OFString *)XMLStringWithIndentation: (unsigned int)indentation { return [self of_XMLStringWithDefaultNS: nil namespaces: nil indentation: indentation level: 0]; } - (OFString *)XMLStringWithDefaultNamespace: (OFString *)defaultNS indentation: (unsigned int)indentation { return [self of_XMLStringWithDefaultNS: defaultNS namespaces: nil indentation: indentation level: 0]; } - (OFXMLElement *)XMLElementBySerializing { void *pool = objc_autoreleasePoolPush(); OFXMLElement *element; element = [OFXMLElement elementWithName: self.className namespace: OFSerializationNS]; if (_name != nil) [element addAttributeWithName: @"name" stringValue: _name]; if (_namespace != nil) [element addAttributeWithName: @"namespace" stringValue: _namespace]; if (_attributes != nil) { OFXMLElement *attributesElement; attributesElement = [OFXMLElement elementWithName: @"attributes" namespace: OFSerializationNS]; [attributesElement addChild: |
︙ | ︙ | |||
854 855 856 857 858 859 860 | } } - (void)setPrefix: (OFString *)prefix forNamespace: (OFString *)namespace { if (prefix.length == 0) @throw [OFInvalidArgumentException exception]; | < < | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | } } - (void)setPrefix: (OFString *)prefix forNamespace: (OFString *)namespace { if (prefix.length == 0) @throw [OFInvalidArgumentException exception]; [_namespaces setObject: prefix forKey: namespace]; } - (void)bindPrefix: (OFString *)prefix forNamespace: (OFString *)namespace { [self setPrefix: prefix forNamespace: namespace]; |
︙ | ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | element = object; if (element->_name != _name && ![element->_name isEqual: _name]) return false; if (element->_namespace != _namespace && ![element->_namespace isEqual: _namespace]) return false; | < < < | 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | element = object; if (element->_name != _name && ![element->_name isEqual: _name]) return false; if (element->_namespace != _namespace && ![element->_namespace isEqual: _namespace]) return false; if (element->_attributes != _attributes && ![element->_attributes isEqual: _attributes]) return false; if (element->_namespaces != _namespaces && ![element->_namespaces isEqual: _namespaces]) return false; if (element->_children != _children && |
︙ | ︙ | |||
1058 1059 1060 1061 1062 1063 1064 | { unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); OFHashAddHash(&hash, _namespace.hash); | < < | 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 | { unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); OFHashAddHash(&hash, _namespace.hash); OFHashAddHash(&hash, _attributes.hash); OFHashAddHash(&hash, _namespaces.hash); OFHashAddHash(&hash, _children.hash); OFHashFinalize(&hash); return hash; } - (id)copy { OFXMLElement *copy = [[OFXMLElement alloc] of_init]; @try { copy->_name = [_name copy]; copy->_namespace = [_namespace copy]; copy->_attributes = [_attributes mutableCopy]; copy->_namespaces = [_namespaces mutableCopy]; copy->_children = [_children mutableCopy]; } @catch (id e) { [copy release]; @throw e; } return copy; } @end |
Modified src/OFXMLNode.h from [202ae69295] to [7374215293].
︙ | ︙ | |||
62 63 64 65 66 67 68 | * @brief A string representing the node as an XML string. */ @property (readonly, nonatomic) OFString *XMLString; - (instancetype)init OF_UNAVAILABLE; - (instancetype)initWithSerialization: (OFXMLElement *)element OF_UNAVAILABLE; | < < < < < < < < < < < < < < < < < < < < < < | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | * @brief A string representing the node as an XML string. */ @property (readonly, nonatomic) OFString *XMLString; - (instancetype)init OF_UNAVAILABLE; - (instancetype)initWithSerialization: (OFXMLElement *)element OF_UNAVAILABLE; /** * @brief The contents of the receiver as a `long long` value in the specified * base. * * @param base The base to use. If the base is 0, base 16 is assumed if the * string starts with 0x (after stripping white spaces). If the * string starts with 0, base 8 is assumed. Otherwise, base 10 is |
︙ | ︙ |
Modified src/OFXMLNode.m from [b17a4348f8] to [ae31a5d0f3].
︙ | ︙ | |||
72 73 74 75 76 77 78 | - (double)doubleValue { return self.stringValue.doubleValue; } - (OFString *)XMLString { | < < < < < < < < < < < | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - (double)doubleValue { return self.stringValue.doubleValue; } - (OFString *)XMLString { OF_UNRECOGNIZED_SELECTOR } - (OFString *)description { return self.XMLString; } - (OFXMLElement *)XMLElementBySerializing { OF_UNRECOGNIZED_SELECTOR } - (id)copy { return [self retain]; } @end |
Modified src/OFXMLParser.h from [30932bc605] to [beb6c0af85].
︙ | ︙ | |||
48 49 50 51 52 53 54 | /** * @brief This callback is called when the XML parser found the start of a new * tag. * * @param parser The parser which found a new tag * @param name The name of the tag which just started * @param prefix The prefix of the tag which just started or `nil` | | | | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | /** * @brief This callback is called when the XML parser found the start of a new * tag. * * @param parser The parser which found a new tag * @param name The name of the tag which just started * @param prefix The prefix of the tag which just started or `nil` * @param nameSpace The namespace of the tag which just started or `nil` * @param attributes The attributes included in the tag which just started or * `nil` */ - (void)parser: (OFXMLParser *)parser didStartElement: (OFString *)name prefix: (nullable OFString *)prefix namespace: (nullable OFString *)nameSpace attributes: (nullable OFArray OF_GENERIC(OFXMLAttribute *) *)attributes; /** * @brief This callback is called when the XML parser found the end of a tag. * * @param parser The parser which found the end of a tag * @param name The name of the tag which just ended * @param prefix The prefix of the tag which just ended or `nil` * @param nameSpace The namespace of the tag which just ended or `nil` */ - (void)parser: (OFXMLParser *)parser didEndElement: (OFString *)name prefix: (nullable OFString *)prefix namespace: (nullable OFString *)nameSpace; /** * @brief This callback is called when the XML parser found characters. * * In case there are comments or CDATA, it is possible that this callback is * called multiple times in a row. * |
︙ | ︙ |
Modified src/OFXMLParser.m from [ece1af7f25] to [7be6fc7234].
︙ | ︙ | |||
110 111 112 113 114 115 116 | [stateInDOCTYPE] = inDOCTYPEState }; static OF_INLINE void appendToBuffer(OFMutableData *buffer, const char *string, OFStringEncoding encoding, size_t length) { | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | [stateInDOCTYPE] = inDOCTYPEState }; static OF_INLINE void appendToBuffer(OFMutableData *buffer, const char *string, OFStringEncoding encoding, size_t length) { if OF_LIKELY (encoding == OFStringEncodingUTF8) [buffer addItems: string count: length]; else { void *pool = objc_autoreleasePoolPush(); OFString *tmp = [OFString stringWithCString: string encoding: encoding length: length]; [buffer addItems: tmp.UTF8String count: tmp.UTF8StringLength]; |
︙ | ︙ |
Modified src/OFXMLProcessingInstruction.m from [ca530a45f7] to [98f7922e9f].
︙ | ︙ | |||
130 131 132 133 134 135 136 | if (_text.length > 0) return [OFString stringWithFormat: @"<?%@ %@?>", _target, _text]; else return [OFString stringWithFormat: @"<?%@?>", _target]; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | if (_text.length > 0) return [OFString stringWithFormat: @"<?%@ %@?>", _target, _text]; else return [OFString stringWithFormat: @"<?%@?>", _target]; } - (OFString *)description { return self.XMLString; } - (OFXMLElement *)XMLElementBySerializing { |
︙ | ︙ |
Modified tests/serialization.xml from [d106910237] to [9c33dfe30d].
︙ | ︙ | |||
10 11 12 13 14 15 16 | <key> <OFString>Blub</OFString> </key> <object> <OFString>B"la</OFString> </object> <key> | < < < < < < < < < < < < < < < < < < < | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <key> <OFString>Blub</OFString> </key> <object> <OFString>B"la</OFString> </object> <key> <OFList> <OFString>Hello</OFString> <OFString>Wo
ld! How are you?</OFString> <OFURL>https://objfw.nil.im/</OFURL> <OFXMLElement name='x'> <children> |
︙ | ︙ | |||
59 60 61 62 63 64 65 66 67 | </object> </OFCountedSet> </OFList> </key> <object> <OFString>list</OFString> </object> </OFMutableDictionary> </serialization> | > > > > > > > > > > > > > > > > > > > | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | </object> </OFCountedSet> </OFList> </key> <object> <OFString>list</OFString> </object> <key> <OFData>MDEyMzQ1Njc4OTo7PEFCQ0RFRkdISklLTE1OT1BRUlNUVVZXWFla</OFData> </key> <object> <OFString>data</OFString> </object> <key> <OFArray> <OFString>Qu"xbar test</OFString> <OFNumber type='signed'>1234</OFNumber> <OFNumber type='float'>40934a456d5cfaad</OFNumber> <OFMutableString>asd</OFMutableString> <OFDate>40934a456d5cfaad</OFDate> </OFArray> </key> <object> <OFString>Hello</OFString> </object> </OFMutableDictionary> </serialization> |