Index: src/OFXMLElementBuilder.m ================================================================== --- src/OFXMLElementBuilder.m +++ src/OFXMLElementBuilder.m @@ -56,15 +56,15 @@ [super dealloc]; } - (void)parser: (OFXMLParser *)parser foundProcessingInstructionWithTarget: (OFString *)target - data: (OFString *)data + text: (OFString *)text { OFXMLProcessingInstruction *node = [OFXMLProcessingInstruction processingInstructionWithTarget: target - data: data]; + text: text]; OFXMLElement *parent = _stack.lastObject; if (parent != nil) [parent addChild: node]; else if ([_delegate respondsToSelector: Index: src/OFXMLParser.h ================================================================== --- src/OFXMLParser.h +++ src/OFXMLParser.h @@ -37,15 +37,15 @@ * @brief This callback is called when the XML parser found a processing * instruction. * * @param parser The parser which found a processing instruction * @param target The target of the processing instruction - * @param data The data of the processing instruction + * @param text The text of the processing instruction */ - (void)parser: (OFXMLParser *)parser foundProcessingInstructionWithTarget: (OFString *)target - data: (OFString *)data; + text: (OFString *)text; /** * @brief This callback is called when the XML parser found the start of a new * tag. * Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -497,11 +497,11 @@ { if (self->_data[self->_i] == '?') self->_level = 1; else if (self->_level == 1 && self->_data[self->_i] == '>') { void *pool = objc_autoreleasePoolPush(); - OFString *PI, *target, *data = nil; + OFString *PI, *target, *text = nil; OFCharacterSet *whitespaceCS; size_t pos; appendToBuffer(self->_buffer, self->_data + self->_last, self->_encoding, self->_i - self->_last); @@ -510,28 +510,28 @@ whitespaceCS = [OFCharacterSet characterSetWithCharactersInString: @" \r\n\r"]; pos = [PI indexOfCharacterFromSet: whitespaceCS]; if (pos != OFNotFound) { target = [PI substringToIndex: pos]; - data = [[PI substringFromIndex: pos + 1] + text = [[PI substringFromIndex: pos + 1] stringByDeletingEnclosingWhitespaces]; - if (data.length == 0) - data = nil; + if (text.length == 0) + text = nil; } else target = PI; if ([target caseInsensitiveCompare: @"xml"] == OFOrderedSame) - if (!parseXMLProcessingInstruction(self, data)) + if (!parseXMLProcessingInstruction(self, text)) @throw [OFMalformedXMLException exceptionWithParser: self]; if ([self->_delegate respondsToSelector: @selector( - parser:foundProcessingInstructionWithTarget:data:)]) + parser:foundProcessingInstructionWithTarget:text:)]) [self->_delegate parser: self foundProcessingInstructionWithTarget: target - data: data]; + text: text]; objc_autoreleasePoolPop(pool); [self->_buffer removeAllItems]; Index: src/OFXMLProcessingInstruction.h ================================================================== --- src/OFXMLProcessingInstruction.h +++ src/OFXMLProcessingInstruction.h @@ -23,45 +23,45 @@ * * @brief A class for representing an XML processing instruction. */ @interface OFXMLProcessingInstruction: OFXMLNode { - OFString *_target, *_data; + OFString *_target, *_Nullable _text; OF_RESERVE_IVARS(OFXMLProcessingInstruction, 4) } /** * @brief The target of the processing instruction. */ @property (readonly, nonatomic) OFString *target; /** - * @brief The data of the processing instruction. + * @brief The text of the processing instruction. */ -@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *data; +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *text; /** * @brief Creates a new OFXMLProcessingInstruction with the specified target - * and data. + * and text. * * @param target The target for the processing instruction - * @param data The data for the processing instruction + * @param text The text for the processing instruction * @return A new OFXMLProcessingInstruction */ + (instancetype)processingInstructionWithTarget: (OFString *)target - data: (OFString *)data; + text: (OFString *)text; /** * @brief Initializes an already allocated OFXMLProcessingInstruction with the - * specified target and data. + * specified target and text. * * @param target The target for the processing instruction - * @param data The data for the processing instruction + * @param text The text for the processing instruction * @return An initialized OFXMLProcessingInstruction */ - (instancetype)initWithTarget: (OFString *)target - data: (OFString *)data OF_DESIGNATED_INITIALIZER; + text: (OFString *)text OF_DESIGNATED_INITIALIZER; - (instancetype)initWithSerialization: (OFXMLElement *)element; @end OF_ASSUME_NONNULL_END Index: src/OFXMLProcessingInstruction.m ================================================================== --- src/OFXMLProcessingInstruction.m +++ src/OFXMLProcessingInstruction.m @@ -24,27 +24,27 @@ #import "OFXMLNode+Private.h" #import "OFInvalidArgumentException.h" @implementation OFXMLProcessingInstruction -@synthesize target = _target, data = _data; +@synthesize target = _target, text = _text; + (instancetype)processingInstructionWithTarget: (OFString *)target - data: (OFString *)data + text: (OFString *)text { return [[[self alloc] initWithTarget: target - data: data] autorelease]; + text: text] autorelease]; } - (instancetype)initWithTarget: (OFString *)target - data: (OFString *)data + text: (OFString *)text { self = [super of_init]; @try { _target = [target copy]; - _data = [data copy]; + _text = [text copy]; } @catch (id e) { [self release]; @throw e; } @@ -65,11 +65,11 @@ namespace: OFSerializationNS]; if (targetAttr.stringValue.length == 0) @throw [OFInvalidArgumentException exception]; self = [self initWithTarget: targetAttr.stringValue - data: element.stringValue]; + text: element.stringValue]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; @@ -79,11 +79,11 @@ } - (void)dealloc { [_target release]; - [_data release]; + [_text release]; [super dealloc]; } - (bool)isEqual: (id)object @@ -99,12 +99,12 @@ processingInstruction = object; if (![processingInstruction->_target isEqual: _target]) return false; - if (processingInstruction->_data != _data && - ![processingInstruction->_data isEqual: _data]) + if (processingInstruction->_text != _text && + ![processingInstruction->_text isEqual: _text]) return false; return true; } @@ -112,11 +112,11 @@ { unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _target.hash); - OFHashAddHash(&hash, _data.hash); + OFHashAddHash(&hash, _text.hash); OFHashFinalize(&hash); return hash; } @@ -125,13 +125,13 @@ return @""; } - (OFString *)XMLString { - if (_data.length > 0) + if (_text.length > 0) return [OFString stringWithFormat: @"", - _target, _data]; + _target, _text]; else return [OFString stringWithFormat: @"", _target]; } - (OFString *)XMLStringWithIndentation: (unsigned int)indentation @@ -147,14 +147,14 @@ char *whitespaces = OFAllocMemory((level * indentation) + 1, 1); memset(whitespaces, ' ', level * indentation); whitespaces[level * indentation] = 0; @try { - if (_data.length > 0) + if (_text.length > 0) ret = [OFString stringWithFormat: @"%s", whitespaces, - _target, _data]; + _target, _text]; else ret = [OFString stringWithFormat: @"%s", whitespaces, _target]; } @finally { OFFreeMemory(whitespaces); @@ -172,11 +172,11 @@ - (OFXMLElement *)XMLElementBySerializing { OFXMLElement *ret = [OFXMLElement elementWithName: self.className namespace: OFSerializationNS - stringValue: _data]; + stringValue: _text]; void *pool = objc_autoreleasePoolPush(); [ret addAttribute: [OFXMLAttribute attributeWithName: @"target" stringValue: _target]]; Index: tests/OFXMLParserTests.m ================================================================== --- tests/OFXMLParserTests.m +++ tests/OFXMLParserTests.m @@ -273,19 +273,19 @@ } } - (void)parser: (OFXMLParser *)parser foundProcessingInstructionWithTarget: (OFString *)target - data: (OFString *)data + text: (OFString *)text { [self parser: parser didCreateEvent: eventTypeProcessingInstruction name: target prefix: nil namespace: nil attributes: nil - string: data]; + string: text]; } - (void)parser: (OFXMLParser *)parser didStartElement: (OFString *)name prefix: (OFString *)prefix