@@ -21,16 +21,16 @@ #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" @implementation OFXMLCharacters -+ (instancetype)charactersWithString: (OFString*)string ++ (instancetype)charactersWithString: (OFString *)string { return [[[self alloc] initWithString: string] autorelease]; } -- initWithString: (OFString*)string +- initWithString: (OFString *)string { self = [super init]; @try { _characters = [string copy]; @@ -40,11 +40,11 @@ } return self; } -- initWithSerialization: (OFXMLElement*)element +- initWithSerialization: (OFXMLElement *)element { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -86,45 +86,45 @@ - (uint32_t)hash { return [_characters hash]; } -- (OFString*)stringValue +- (OFString *)stringValue { return [[_characters copy] autorelease]; } -- (void)setStringValue: (OFString*)stringValue +- (void)setStringValue: (OFString *)stringValue { OFString *old = _characters; _characters = [stringValue copy]; [old release]; } -- (OFString*)XMLString +- (OFString *)XMLString +{ + return [_characters stringByXMLEscaping]; +} + +- (OFString *)XMLStringWithIndentation: (unsigned int)indentation { return [_characters stringByXMLEscaping]; } -- (OFString*)XMLStringWithIndentation: (unsigned int)indentation +- (OFString *)XMLStringWithIndentation: (unsigned int)indentation + level: (unsigned int)level { return [_characters stringByXMLEscaping]; } -- (OFString*)XMLStringWithIndentation: (unsigned int)indentation - level: (unsigned int)level +- (OFString *)description { return [_characters stringByXMLEscaping]; } -- (OFString*)description -{ - return [_characters stringByXMLEscaping]; -} - -- (OFXMLElement*)XMLElementBySerializing +- (OFXMLElement *)XMLElementBySerializing { return [OFXMLElement elementWithName: [self className] namespace: OF_SERIALIZATION_NS stringValue: _characters]; } @end