Frameworks/Adium Framework/Source/AIXMLElement.m
author Evan Schoenberg
Thu, 14 Nov 2019 21:09:06 -0500
branchadium-1.5.11
changeset 6016 325e2ab3406f
parent 3568 1cd209516587
permissions -rw-r--r--
Fixed a bunch of warnings
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as > to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
     1
/* AIXMLElement.m
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
     2
 *
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
     3
 * Created by Peter Hosey on 2006-06-07.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
     4
 *
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
     5
 * This class is explicitly released under the BSD license with the following modification:
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
     6
 * It may be used without reproduction of its copyright notice within The Adium Project.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
     7
 *
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
     8
 * This class was created for use in the Adium project, which is released under the GPL.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
     9
 * The release of this specific class (AIXMLElement) under BSD in no way changes the licensing of any other portion
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    10
 * of the Adium project.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    11
 *
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    12
 ****
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    13
 Copyright ?? 2006 Peter Hosey, Colin Barrett
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    14
 All rights reserved.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    15
 
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    16
 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    17
 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    18
 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    19
 Neither the name of Peter Hosey nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    20
 
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    21
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    22
 */
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    23
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    24
#import <Adium/AIXMLElement.h>
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    25
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    26
#import <AIUtilities/AIStringAdditions.h>
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    27
3498
0a9e33894575 Patch from an anonymous source to fix warnings from Clang about delegate protocols not being explicitly declared
Evan Schoenberg
parents: 3405
diff changeset
    28
#import <ESDebugAILog.h>
0a9e33894575 Patch from an anonymous source to fix warnings from Clang about delegate protocols not being explicitly declared
Evan Schoenberg
parents: 3405
diff changeset
    29
1643
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    30
@interface AIXMLElement()
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    31
@property (readwrite, retain, nonatomic) NSMutableArray *attributeNames;
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    32
@property (readwrite, retain, nonatomic) NSMutableArray *attributeValues;
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    33
@end
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    34
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    35
@implementation AIXMLElement
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    36
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    37
+ (id) elementWithNamespaceName:(NSString *)namespace elementName:(NSString *)newName
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    38
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    39
	if (namespace)
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    40
		newName = [NSString stringWithFormat:@"%@:%@", namespace, newName];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    41
	return [self elementWithName:newName];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    42
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    43
- (id) initWithNamespaceName:(NSString *)namespace elementName:(NSString *)newName
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    44
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    45
	if (namespace)
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    46
		newName = [NSString stringWithFormat:@"%@:%@", namespace, newName];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    47
	return [self initWithName:newName];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    48
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    49
+ (id) elementWithName:(NSString *)newName
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    50
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    51
	return [[[self alloc] initWithName:newName] autorelease];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    52
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    53
- (id) initWithName:(NSString *)newName
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    54
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    55
	NSParameterAssert(newName != nil);
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    56
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    57
	if ((self = [super init])) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    58
		name = [newName copy];
1643
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    59
		self.attributeNames  = [NSMutableArray array];
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    60
		self.attributeValues = [NSMutableArray array];
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    61
		contents = [[NSMutableArray alloc] init];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    62
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    63
		//If a list of self-closing tags exists, this could change to a lookup into a static NSSet
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    64
		selfCloses = (([newName caseInsensitiveCompare:@"br"] == NSOrderedSame) ? YES : NO);
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    65
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    66
	return self;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    67
}
1643
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    68
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    69
@synthesize attributeNames, attributeValues;
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    70
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    71
- (id) init
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    72
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    73
	NSException *exc = [NSException exceptionWithName:@"Can't init AIXMLElement"
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    74
											   reason:@"AIXMLElement does not support the -init method; use -initWithName: instead."
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    75
											 userInfo:nil];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    76
	[exc raise];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    77
	return nil;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    78
}
1643
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    79
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    80
- (void) dealloc
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    81
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    82
	[name release];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    83
	[attributeNames  release];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    84
	[attributeValues release];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    85
	[contents release];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    86
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    87
	[super dealloc];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    88
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    89
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    90
- (id) copyWithZone:(NSZone *)zone {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    91
	AIXMLElement *other = [[AIXMLElement allocWithZone:zone] initWithName:name];
1643
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    92
	other.attributeNames  = [NSMutableArray arrayWithArray:attributeNames];
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    93
	other.attributeValues = [NSMutableArray arrayWithArray:attributeValues];
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    94
	other.selfCloses = selfCloses;
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
    95
	other.contents = self.contents; //uses setArray, so this copies
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    96
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    97
	return other;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    98
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
    99
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   100
#pragma mark -
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   101
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   102
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   103
 * @brief This element's name
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   104
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   105
 * @returns An NSString of this element's name
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   106
 */
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   107
- (NSString *)name
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   108
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   109
	return name;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   110
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   111
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   112
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   113
 * @brief Number of attributes
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   114
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   115
 * @returns The number of attributes for this element.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   116
 */
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   117
- (NSUInteger)numberOfAttributes
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   118
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   119
	return [attributeNames count];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   120
}
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   121
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   122
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   123
 * @brief Attributes for this element
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   124
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   125
 * @returns An NSDictionary keyed on the attribute names with their values
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   126
 */
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   127
- (NSDictionary *)attributes
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   128
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   129
	return [NSDictionary dictionaryWithObjects:attributeValues forKeys:attributeNames];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   130
}
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   131
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   132
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   133
 * @brief Set attributes and their values
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   134
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   135
 * @param newAttrNames An array of NSStrings, new names of the attributes
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   136
 * @param newAttrVals An array of NSStrings, new values of the given attributes
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   137
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   138
 * You cannot duplicate attributes in this assignment, and you must provide arrays of the same length.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   139
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   140
 * This overrides any currently-set attributes.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   141
 */
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   142
- (void)setAttributeNames:(NSArray *)newAttrNames values:(NSArray *)newAttrVals
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   143
{
6016
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 3568
diff changeset
   144
	NSAssert2([newAttrNames count] == [newAttrVals count], @"Attribute names and values have different lengths, %lui and %lui respectively", (unsigned long)[newAttrNames count], [newAttrVals count]);
2961
2b43e083a20f Unify AIXMLElement, including the method introduced in [58897a698d28], on NSUInteger, fixing at least one type-mismatch warning.
Peter Hosey <hg@boredzo.org>
parents: 2940
diff changeset
   145
	NSUInteger numberOfDuplicates = [newAttrNames count] - [[NSSet setWithArray:newAttrNames] count];
6016
325e2ab3406f Fixed a bunch of warnings
Evan Schoenberg
parents: 3568
diff changeset
   146
    NSAssert1(numberOfDuplicates == 0, @"Duplicate attributes are not allowed; found %lui duplicate(s)", (unsigned long)numberOfDuplicates);
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   147
	
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   148
	[attributeNames setArray:newAttrNames];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   149
	[attributeValues setArray:newAttrVals];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   150
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   151
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   152
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   153
 * @brief Set an attribute and its value
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   154
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   155
 * This will replace any currently-set value if overriding, otherwise it adds the attribute.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   156
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   157
 * @param attrVal The NSString value for the attribute
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   158
 * @param attrName The NSString name for the attribute
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   159
 */
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   160
- (void)setValue:(NSString *)attrVal forAttribute:(NSString *)attrName
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   161
{
3075
d26a554c0645 Reveal shadowed symbols in Adium.framework.
Stephen Holt <sholt@adium.im>
parents: 2961
diff changeset
   162
	NSUInteger idx = [attributeNames indexOfObject:attrName];
d26a554c0645 Reveal shadowed symbols in Adium.framework.
Stephen Holt <sholt@adium.im>
parents: 2961
diff changeset
   163
	if (idx != NSNotFound) {
d26a554c0645 Reveal shadowed symbols in Adium.framework.
Stephen Holt <sholt@adium.im>
parents: 2961
diff changeset
   164
		[attributeValues replaceObjectAtIndex:idx withObject:attrVal];
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   165
	} else {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   166
		[attributeNames addObject:attrName];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   167
		[attributeValues addObject:attrVal];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   168
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   169
}
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   170
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   171
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   172
 * @brief The value of an attribute
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   173
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   174
 * @param attrName The name of the attribute
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   175
 * @returns The value for the given attrName attribute
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   176
 */
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   177
- (NSString *)valueForAttribute:(NSString *)attrName
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   178
{
3075
d26a554c0645 Reveal shadowed symbols in Adium.framework.
Stephen Holt <sholt@adium.im>
parents: 2961
diff changeset
   179
	NSUInteger idx = [attributeNames indexOfObject:attrName];
d26a554c0645 Reveal shadowed symbols in Adium.framework.
Stephen Holt <sholt@adium.im>
parents: 2961
diff changeset
   180
	if (idx != NSNotFound)
d26a554c0645 Reveal shadowed symbols in Adium.framework.
Stephen Holt <sholt@adium.im>
parents: 2961
diff changeset
   181
		return [attributeValues objectAtIndex:idx];
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   182
	return nil;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   183
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   184
1643
bdb155493a36 Make AIXMLElement -copyWithZone: not leak
David Smith
parents: 1227
diff changeset
   185
@synthesize selfCloses;
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   186
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   187
#pragma mark -
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   188
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   189
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   190
 * @brief Add an already-escaped object
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   191
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   192
 * @param obj The already-escaped object, either an NSString or an AIXMLelement
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   193
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   194
 * Adds the object as a child for this element at the last index.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   195
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   196
 * Unlike -addObject:, this does not attempt to escape any XML entities present in the string.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   197
 * This is useful for reading in already-escaped content, such as from an XML file.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   198
 */
1227
78a272b0a45f Completes [26431], but doesn't revert [25499]. Modifies AIXMLAppender to use AIXMLElements instead of NSXMLElements (which lack the ability to put spaces between elements, log > as &gt;, which are major killjoys). Fixes all the issues I've found with logging.
Zachary West <zacw@adiumx.com>
parents: 1226
diff changeset
   199
- (void)addEscapedObject:(id)obj
78a272b0a45f Completes [26431], but doesn't revert [25499]. Modifies AIXMLAppender to use AIXMLElements instead of NSXMLElements (which lack the ability to put spaces between elements, log > as &gt;, which are major killjoys). Fixes all the issues I've found with logging.
Zachary West <zacw@adiumx.com>
parents: 1226
diff changeset
   200
{
78a272b0a45f Completes [26431], but doesn't revert [25499]. Modifies AIXMLAppender to use AIXMLElements instead of NSXMLElements (which lack the ability to put spaces between elements, log > as &gt;, which are major killjoys). Fixes all the issues I've found with logging.
Zachary West <zacw@adiumx.com>
parents: 1226
diff changeset
   201
	//Warn but don't assert if null is added.  Adding nothing is a no-op, but we may want to investigate where this is happening further.
3405
880024cc6758 Patch from a reliable anonymous source to log and return rather than assert if -[AIXMLElement addEscapedObject:] is passed nil.
Evan Schoenberg
parents: 3075
diff changeset
   202
	if (!obj) {
3498
0a9e33894575 Patch from an anonymous source to fix warnings from Clang about delegate protocols not being explicitly declared
Evan Schoenberg
parents: 3405
diff changeset
   203
		AILog(@"Attempted to add null to AIXMLElement %@, backtrace available in debug mode", obj);
0a9e33894575 Patch from an anonymous source to fix warnings from Clang about delegate protocols not being explicitly declared
Evan Schoenberg
parents: 3405
diff changeset
   204
		AILogBacktrace();
3405
880024cc6758 Patch from a reliable anonymous source to log and return rather than assert if -[AIXMLElement addEscapedObject:] is passed nil.
Evan Schoenberg
parents: 3075
diff changeset
   205
		return;
880024cc6758 Patch from a reliable anonymous source to log and return rather than assert if -[AIXMLElement addEscapedObject:] is passed nil.
Evan Schoenberg
parents: 3075
diff changeset
   206
	}
1227
78a272b0a45f Completes [26431], but doesn't revert [25499]. Modifies AIXMLAppender to use AIXMLElements instead of NSXMLElements (which lack the ability to put spaces between elements, log > as &gt;, which are major killjoys). Fixes all the issues I've found with logging.
Zachary West <zacw@adiumx.com>
parents: 1226
diff changeset
   207
	NSAssert2(([obj isKindOfClass:[NSString class]] || [obj isKindOfClass:[AIXMLElement class]]), @"%@: addObject: %@ is of incorrect class",self,obj);
78a272b0a45f Completes [26431], but doesn't revert [25499]. Modifies AIXMLAppender to use AIXMLElements instead of NSXMLElements (which lack the ability to put spaces between elements, log > as &gt;, which are major killjoys). Fixes all the issues I've found with logging.
Zachary West <zacw@adiumx.com>
parents: 1226
diff changeset
   208
	
78a272b0a45f Completes [26431], but doesn't revert [25499]. Modifies AIXMLAppender to use AIXMLElements instead of NSXMLElements (which lack the ability to put spaces between elements, log > as &gt;, which are major killjoys). Fixes all the issues I've found with logging.
Zachary West <zacw@adiumx.com>
parents: 1226
diff changeset
   209
	[contents addObject:obj];
78a272b0a45f Completes [26431], but doesn't revert [25499]. Modifies AIXMLAppender to use AIXMLElements instead of NSXMLElements (which lack the ability to put spaces between elements, log > as &gt;, which are major killjoys). Fixes all the issues I've found with logging.
Zachary West <zacw@adiumx.com>
parents: 1226
diff changeset
   210
}
78a272b0a45f Completes [26431], but doesn't revert [25499]. Modifies AIXMLAppender to use AIXMLElements instead of NSXMLElements (which lack the ability to put spaces between elements, log > as &gt;, which are major killjoys). Fixes all the issues I've found with logging.
Zachary West <zacw@adiumx.com>
parents: 1226
diff changeset
   211
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   212
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   213
 * @brief Add an unescaped object
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   214
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   215
 * @param obj The unescaped object, either an NSString or an AIXMLelement
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   216
 * 
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   217
 * Adds the object as a child for this element at the last index.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   218
 */
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   219
- (void)addObject:(id)obj
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   220
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   221
	//Warn but don't assert if null is added.  Adding nothing is a no-op, but we may want to investigate where this is happening further.
3568
1cd209516587 Just like in the patch from our anonymous source, log a lot but don't assert when adding nil via addObject:.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3498
diff changeset
   222
	if (!obj) {
1cd209516587 Just like in the patch from our anonymous source, log a lot but don't assert when adding nil via addObject:.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3498
diff changeset
   223
		AILog(@"Attempted to add null to AIXMLElement %@, backtrace available in debug mode", obj);
1cd209516587 Just like in the patch from our anonymous source, log a lot but don't assert when adding nil via addObject:.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3498
diff changeset
   224
		AILogBacktrace();
1cd209516587 Just like in the patch from our anonymous source, log a lot but don't assert when adding nil via addObject:.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3498
diff changeset
   225
		return;
1cd209516587 Just like in the patch from our anonymous source, log a lot but don't assert when adding nil via addObject:.
Thijs Alkemade <thijsalkemade@gmail.com>
parents: 3498
diff changeset
   226
	}
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   227
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   228
	BOOL isString = [obj isKindOfClass:[NSString class]];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   229
	NSAssert2((isString || [obj isKindOfClass:[AIXMLElement class]]), @"%@: addObject: %@ is of incorrect class",self,obj);
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   230
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   231
	if(isString) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   232
		obj = [obj stringByEscapingForXMLWithEntities:nil];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   233
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   234
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   235
	[contents addObject:obj];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   236
}
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   237
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   238
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   239
 * @brief Add objects from an array.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   240
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   241
 * @param array The NSArray of NSString or AIXMLElement elements to add as children.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   242
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   243
 * Calls -addObject: on all of the elements in the array, so they must all be valid inputs for -addObject:
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   244
 */
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   245
- (void) addObjectsFromArray:(NSArray *)array
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   246
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   247
	//We do it this way for the assertion, and to get free escaping of strings.
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   248
	for (id obj in array) {
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   249
		[self addObject:obj];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   250
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   251
}
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   252
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   253
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   254
 * @brief Insert an escaped object at an index
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   255
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   256
 * @param obj The NSString or AIXMLElement object to insert
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   257
 * @param idx The index to insert the object at
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   258
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   259
 * Much like -addEscapedObject:, this inserts an object at a specific index without escaping it.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   260
 */
2961
2b43e083a20f Unify AIXMLElement, including the method introduced in [58897a698d28], on NSUInteger, fixing at least one type-mismatch warning.
Peter Hosey <hg@boredzo.org>
parents: 2940
diff changeset
   261
- (void)insertEscapedObject:(id)obj atIndex:(NSUInteger)idx
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   262
{
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   263
	NSParameterAssert([obj isKindOfClass:[NSString class]] || [obj isKindOfClass:[AIXMLElement class]]);
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   264
	
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   265
	[contents insertObject:obj atIndex:idx];
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   266
}
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   267
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   268
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   269
 * @brief Insert an unescaped object at an index
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   270
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   271
 * @param obj The NSString or AIXMLElement object to insert
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   272
 * @param idx The index to insert the object at
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   273
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   274
 * Much like -addObject:, this inserts an object at a specific index after escaping it.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   275
 */
2961
2b43e083a20f Unify AIXMLElement, including the method introduced in [58897a698d28], on NSUInteger, fixing at least one type-mismatch warning.
Peter Hosey <hg@boredzo.org>
parents: 2940
diff changeset
   276
- (void) insertObject:(id)obj atIndex:(NSUInteger)idx
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   277
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   278
	BOOL isString = [obj isKindOfClass:[NSString class]];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   279
	NSParameterAssert(isString || [obj isKindOfClass:[AIXMLElement class]]);
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   280
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   281
	if(isString) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   282
		obj = [obj stringByEscapingForXMLWithEntities:nil];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   283
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   284
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   285
	[contents insertObject:obj atIndex:idx];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   286
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   287
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   288
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   289
 * @brief The contents of this element
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   290
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   291
 * @returns An NSArray of the NSString or AIXMLElement children for this element
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   292
 */
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   293
- (NSArray *)contents
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   294
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   295
	return contents;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   296
}
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   297
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   298
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   299
 * @brief Set the contents of this element
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   300
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   301
 * @param newContents The NSArray of NSString or AIXMLElement elements to set as the new contents.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   302
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   303
 * This overrides any currently-set contents.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   304
 */
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   305
- (void)setContents:(NSArray *)newContents
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   306
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   307
	[contents setArray:newContents];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   308
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   309
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   310
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   311
 * @brief The contents of this element as an XML string.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   312
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   313
 * @returns An NSString which corresponds to an XML representation of this element and its children.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   314
 */
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   315
- (NSString *)contentsAsXMLString
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   316
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   317
	NSMutableString *contentString = [NSMutableString string];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   318
	id obj = nil;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   319
	for (obj in contents) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   320
		if ([obj isKindOfClass:[NSString class]])
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   321
			[contentString appendString:obj];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   322
		else if ([obj isKindOfClass:[AIXMLElement class]])
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   323
			[contentString appendString:[obj XMLString]];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   324
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   325
	return contentString;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   326
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   327
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   328
#pragma mark -
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   329
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   330
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   331
 * @brief Quoted XML attribute value string for string
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   332
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   333
 * @param str The string to quote
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   334
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   335
 * @returns An escaped, quoted string for the given string.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   336
 */
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   337
- (NSString *)quotedXMLAttributeValueStringForString:(NSString *)str
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   338
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   339
	return [NSString stringWithFormat:@"\"%@\"", [str stringByEscapingForXMLWithEntities:nil]];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   340
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   341
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   342
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   343
 * @brief Append an XML representation of the element string to a mutable string
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   344
 * 
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   345
 * @param string The NSMutableString to append to
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   346
 */
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   347
- (void)appendXMLStringtoString:(NSMutableString *)string
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   348
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   349
	[string appendFormat:@"<%@", name];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   350
	if ([attributeNames count]) {
2961
2b43e083a20f Unify AIXMLElement, including the method introduced in [58897a698d28], on NSUInteger, fixing at least one type-mismatch warning.
Peter Hosey <hg@boredzo.org>
parents: 2940
diff changeset
   351
		NSUInteger attributeIdx = 0U;
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   352
		NSString *key;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   353
		for (key in attributeNames) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   354
			NSString *value = [attributeValues objectAtIndex:attributeIdx++];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   355
			if ([value respondsToSelector:@selector(stringValue)]) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   356
				value = [(NSNumber *)value stringValue];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   357
			} else if ([value respondsToSelector:@selector(absoluteString)]) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   358
				value = [(NSURL *)value absoluteString];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   359
			}
2632
4229267e69e1 Cheery picked from adium-1.4@07e07f9788a6: Undo the part of [3855f70905bd]: It caused strings to be incorrectly escaped and causing our XML parsing to break. Rather, escape hash-symbols when parsing in XML data as not to confuse AIHTMLDecoder.
Stephen Holt <sholt@adium.im>
parents: 2604
diff changeset
   360
			[string appendFormat:@" %@=%@", key, [self quotedXMLAttributeValueStringForString:value]];
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   361
		}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   362
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   363
	if ((![contents count]) && (selfCloses)) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   364
		[string appendString:@" /"];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   365
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   366
	[string appendString:@">"];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   367
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   368
	id obj;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   369
	for (obj in contents) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   370
		if ([obj isKindOfClass:[NSString class]]) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   371
			[string appendString:(NSString *)obj];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   372
		} else if([obj isKindOfClass:[AIXMLElement class]]) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   373
			[(AIXMLElement *)obj appendXMLStringtoString:string];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   374
		}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   375
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   376
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   377
	if ([contents count] || !selfCloses) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   378
		[string appendFormat:@"</%@>", name];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   379
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   380
}
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   381
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   382
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   383
 * @brief An XML string representation of this element
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   384
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   385
 * @returns An NSString of an XML representation of this element
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   386
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   387
 * This is equivalent to -appendXMLStringToString: onto an empty string.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   388
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   389
 * This includes the element, its attributes, and its children and their attributes.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   390
 */
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   391
- (NSString *)XMLString
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   392
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   393
	NSMutableString *string = [NSMutableString string];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   394
	[self appendXMLStringtoString:string];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   395
	return [NSString stringWithString:string];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   396
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   397
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   398
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   399
 * @brief Append a UTF-8 XML representation of the element string to a mutable string
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   400
 * 
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   401
 * @param string The NSMutableString to append to
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   402
 */
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   403
- (void)appendUTF8XMLBytesToData:(NSMutableData *)data
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   404
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   405
	NSMutableString *startTag = [NSMutableString stringWithFormat:@"<%@", name];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   406
	if ([self numberOfAttributes]) {
2961
2b43e083a20f Unify AIXMLElement, including the method introduced in [58897a698d28], on NSUInteger, fixing at least one type-mismatch warning.
Peter Hosey <hg@boredzo.org>
parents: 2940
diff changeset
   407
		NSUInteger attributeIdx = 0U;
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   408
		NSString *key;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   409
		for (key in attributeNames) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   410
			NSString *value = [attributeValues objectAtIndex:attributeIdx++];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   411
			if ([value respondsToSelector:@selector(stringValue)]) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   412
				value = [(NSNumber *)value stringValue];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   413
			} else if ([value respondsToSelector:@selector(absoluteString)]) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   414
				value = [(NSURL *)value absoluteString];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   415
			}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   416
			[startTag appendFormat:@" %@=%@", key, [self quotedXMLAttributeValueStringForString:value]];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   417
		}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   418
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   419
	if ((![contents count]) && (selfCloses)) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   420
		[startTag appendString:@" /"];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   421
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   422
	[startTag appendString:@">"];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   423
	[data appendData:[startTag dataUsingEncoding:NSUTF8StringEncoding]];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   424
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   425
	id obj;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   426
	for (obj in contents) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   427
		if ([obj isKindOfClass:[NSString class]]) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   428
			[data appendData:[(NSString *)obj dataUsingEncoding:NSUTF8StringEncoding]];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   429
		} else if([obj isKindOfClass:[AIXMLElement class]]) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   430
			[(AIXMLElement *)obj appendUTF8XMLBytesToData:data];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   431
		}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   432
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   433
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   434
	if ([contents count] || !selfCloses) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   435
		[data appendData:[[NSString stringWithFormat:@"</%@>", name] dataUsingEncoding:NSUTF8StringEncoding]];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   436
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   437
}
2940
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   438
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   439
/*!
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   440
 * @brief A UTF-8 XML string representation of this element
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   441
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   442
 * @returns An NSString of a UTF-8 XML representation of this element
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   443
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   444
 * This is equivalent to -appendUTF8XMLStringToString: onto an empty string.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   445
 *
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   446
 * This includes the element, its attributes, and its children and their attributes.
58897a698d28 Doxygenize AIXMLElement and add -insertEscapedObject:atIndex: for use in a future commit.
Zachary West <zacw@adium.im>
parents: 2632
diff changeset
   447
 */
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   448
- (NSData *)UTF8XMLData
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   449
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   450
	NSMutableData *data = [NSMutableData data];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   451
	[self appendUTF8XMLBytesToData:data];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   452
	return [NSData dataWithData:data];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   453
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   454
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   455
- (NSString *)description
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   456
{
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   457
	NSMutableString *string = [NSMutableString stringWithFormat:@"<%@ AIXMLElement:id=\"%p\"", name, self];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   458
	if ([attributeNames count] && [attributeValues count]) { //there's no way these could be different values, but whatever
2961
2b43e083a20f Unify AIXMLElement, including the method introduced in [58897a698d28], on NSUInteger, fixing at least one type-mismatch warning.
Peter Hosey <hg@boredzo.org>
parents: 2940
diff changeset
   459
		NSUInteger attributeIdx = 0U;
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   460
		NSString *key;
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   461
		for (key in attributeNames) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   462
			NSString *value = [attributeValues objectAtIndex:attributeIdx++];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   463
			if ([value respondsToSelector:@selector(stringValue)]) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   464
				value = [(NSNumber *)value stringValue];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   465
			} else if ([value respondsToSelector:@selector(absoluteString)]) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   466
				value = [(NSURL *)value absoluteString];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   467
			}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   468
			[string appendFormat:@" %@=%@", key, [self quotedXMLAttributeValueStringForString:value]];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   469
		}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   470
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   471
	[string appendString:@" />"];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   472
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   473
	return [NSString stringWithString:string];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   474
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   475
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   476
#pragma mark KVC
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   477
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   478
/*
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   479
These aren't working. I recommend calling -objectForKey on the return value of -attributes.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   480
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   481
Adium[302:117] The following unhandled exception was ignored: NSUnknownKeyException ([<AIXMLElement 0xce582b0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key auto.)
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   482
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   483
*/
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   484
/*
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   485
- (id) valueForKey:(NSString *)key {
2961
2b43e083a20f Unify AIXMLElement, including the method introduced in [58897a698d28], on NSUInteger, fixing at least one type-mismatch warning.
Peter Hosey <hg@boredzo.org>
parents: 2940
diff changeset
   486
	NSUInteger idx = [attributeNames indexOfObject:key];	
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   487
	return (idx != NSNotFound) ? [attributeValues objectAtIndex:idx] : [super valueForKey:key];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   488
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   489
//FIXME: this shouldn't clobber setObject:forKey: on NSObject.
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   490
- (void) setValue:(id)obj forKey:(NSString *)key {
2961
2b43e083a20f Unify AIXMLElement, including the method introduced in [58897a698d28], on NSUInteger, fixing at least one type-mismatch warning.
Peter Hosey <hg@boredzo.org>
parents: 2940
diff changeset
   491
	NSUInteger idx = [attributeNames indexOfObject:key];
1226
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   492
	if(idx == NSNotFound) {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   493
		[attributeNames addObject:key];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   494
		[attributeValues addObject:obj];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   495
	} else {
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   496
		[attributeValues replaceObjectAtIndex:idx withObject:obj];
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   497
	}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   498
}
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   499
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   500
*/
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   501
83a767c75be7 Revert [25511], [25538], [25539] which removed AIXMLElement. This breaks our ability to log elements the way we want (notably, > as &gt; to avoid problems with LMX's reverse-parsing). This is still broken, though: [25499]'s use of NSXMLElement causes the changes to encoding we've made in AIXMLElement to be reverted.
Zachary West <zacw@adiumx.com>
parents:
diff changeset
   502
@end