Overview
Comment: | Ignore whitespaces around the root element in -[initWithXMLString]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | 0.5 |
Files: | files | file ages | folders |
SHA3-256: |
46056b5fa1fd887b5ea5b6da435426a3 |
User & Date: | js on 2011-05-14 19:50:18 |
Other Links: | branch diff | manifest | tags |
Context
2011-05-14
| ||
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 | |
2011-05-12
| ||
19:47 | Also set finishedParsing if the root element is in short form. check-in: 05c29433ac user: js tags: 0.5 | |
Changes
Modified src/OFXMLElement.m from [7d828168bf] to [6fd40e1ec7].
︙ | ︙ | |||
40 41 42 43 44 45 46 | } @end @implementation OFXMLElement_OFXMLElementBuilderDelegate - (void)elementBuilder: (OFXMLElementBuilder*)builder didBuildElement: (OFXMLElement*)elem { | > > > > > > | > | 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*)elem { /* * Make sure we don't take whitespaces before or after the root element * into account. */ if ([elem name] != nil) { assert(element == nil); element = [elem 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 |