Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -17,10 +17,19 @@ #import "OFAutoreleasePool.h" #import "OFExceptions.h" #import "OFMacros.h" int _OFXMLParser_reference; + +static OF_INLINE OFString* +transform_string(OFString *cache, OFObject *handler) +{ + /* TODO: Support for xml:space */ + + [cache removeLeadingAndTrailingWhitespaces]; + return [cache stringByXMLUnescapingWithHandler: handler]; +} static OF_INLINE OFString* parse_numeric_entity(const char *entity, size_t length) { uint32_t c; @@ -140,14 +149,11 @@ if ([cache length] > 0) { OFString *str; pool = [[OFAutoreleasePool alloc] init]; - str = [cache - stringByXMLUnescapingWithHandler: - self]; - + str = transform_string(cache, self); [delegate xmlParser: self foundString: str]; [pool release]; } Index: tests/OFXMLParser/OFXMLParser.m ================================================================== --- tests/OFXMLParser/OFXMLParser.m +++ tests/OFXMLParser/OFXMLParser.m @@ -84,12 +84,12 @@ @end int main() { - const char *foo = "bar" - "foo<barbarquxbar" + const char *foo = "bar\r\n" + "foo<barbar quxbar\r\n" ""; size_t len = strlen(foo); size_t i; OFXMLParser *parser = [OFXMLParser xmlParser];