Overview
| Comment: | Ignore whitespaces around the root element in -[initWithXMLString]. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
12a8ac4cb3b6469200feb2ff1f262804 |
| User & Date: | js on 2011-05-14 19:48:11 |
| Other Links: | manifest | tags |
Context
|
2011-05-14
| ||
| 22:38 | Fix of_unicode_string_length() and actually use it. (check-in: 44bb6eeef3 user: js tags: trunk) | |
| 19:48 | Ignore whitespaces around the root element in -[initWithXMLString]. (check-in: 12a8ac4cb3 user: js tags: trunk) | |
| 12:26 | Use XML for serialization. (check-in: 494dca4ae4 user: js tags: trunk) | |
Changes
Modified src/OFXMLElement.m from [d290a6e873] to [476d990507].
| ︙ | ︙ | |||
40 41 42 43 44 45 46 |
}
@end
@implementation OFXMLElement_OFXMLElementBuilderDelegate
- (void)elementBuilder: (OFXMLElementBuilder*)builder
didBuildElement: (OFXMLElement*)element_
{
| > > > > > > | > | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
}
@end
@implementation OFXMLElement_OFXMLElementBuilderDelegate
- (void)elementBuilder: (OFXMLElementBuilder*)builder
didBuildElement: (OFXMLElement*)element_
{
/*
* Make sure we don't take whitespaces before or after the root element
* into account.
*/
if ([element_ name] != nil) {
assert(element == nil);
element = [element_ retain];
}
}
- (void)dealloc
{
[element release];
[super dealloc];
|
| ︙ | ︙ |
Modified tests/OFXMLElementTests.m from [1e31b5bb2b] to [fe66efda43].
| ︙ | ︙ | |||
115 116 117 118 119 120 121 | R([elem[2] addChild: [OFXMLElement elementWithName: @"bar" namespace: @"urn:objfw:test"]]) && [[elem[2] XMLString] isEqual: @"<objfw-test:foo test='test'><objfw-test:bar/></objfw-test:foo>"]) TEST(@"+[elementWithXMLString:] and -[stringValue]", [[[OFXMLElement elementWithXMLString: | > | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | R([elem[2] addChild: [OFXMLElement elementWithName: @"bar" namespace: @"urn:objfw:test"]]) && [[elem[2] XMLString] isEqual: @"<objfw-test:foo test='test'><objfw-test:bar/></objfw-test:foo>"]) TEST(@"+[elementWithXMLString:] and -[stringValue]", [[[OFXMLElement elementWithXMLString: @"<?xml version='1.0' encoding='UTF-8'?>\r\n<x>foo<![CDATA[bar]]>" @"<y>b<!-- fooo -->az</y>qux</x>"] stringValue] isEqual: @"foobarbazqux"]) TEST(@"-[elementsForName:namespace:]", (a = [elem[2] elementsForName: @"bar" namespace: @"urn:objfw:test"]) && [a count] == 1 && [[[a firstObject] XMLString] isEqual: @"<bar xmlns='urn:objfw:test'/>"]) [pool drain]; } @end |