mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-11 00:30:49 +00:00
replace a few lost lines
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34415 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
40f0d0425c
commit
bcd94d6a14
3 changed files with 62 additions and 17 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2012-01-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSXMLDocument.m:
|
||||||
|
* Source/NSXMLElement.m:
|
||||||
|
Replace a few lines accidentally lost.
|
||||||
|
|
||||||
2012-01-04 Richard Frith-Macdonald <rfm@gnu.org>
|
2012-01-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Headers/Foundation/NSXMLDocument.h:
|
* Headers/Foundation/NSXMLDocument.h:
|
||||||
|
|
|
@ -93,16 +93,24 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
||||||
GS_CREATE_INTERNAL(NSXMLDocument)
|
GS_CREATE_INTERNAL(NSXMLDocument)
|
||||||
if ((self = [super initWithKind: NSXMLDocumentKind options: 0]) != nil)
|
if ((self = [super initWithKind: NSXMLDocumentKind options: 0]) != nil)
|
||||||
{
|
{
|
||||||
NSXMLParser *parser = [[NSXMLParser alloc] initWithData: data];
|
if (nil != data)
|
||||||
|
|
||||||
if (parser != nil)
|
|
||||||
{
|
{
|
||||||
internal->standalone = YES;
|
NSXMLParser *parser = [[NSXMLParser alloc] initWithData: data];
|
||||||
internal->elementStack = [[NSMutableArray alloc] initWithCapacity: 10];
|
|
||||||
ASSIGN(internal->xmlData, data);
|
if (nil == parser)
|
||||||
[parser setDelegate: self];
|
{
|
||||||
[parser parse];
|
DESTROY(self);
|
||||||
RELEASE(parser);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
internal->standalone = YES;
|
||||||
|
internal->elementStack
|
||||||
|
= [[NSMutableArray alloc] initWithCapacity: 10];
|
||||||
|
ASSIGN(internal->xmlData, data);
|
||||||
|
[parser setDelegate: self];
|
||||||
|
[parser parse];
|
||||||
|
RELEASE(parser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
@ -218,7 +226,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
||||||
{
|
{
|
||||||
[child setParent: self];
|
[child setParent: self];
|
||||||
[(NSMutableArray *)internal->children insertObject: child atIndex: index];
|
[(NSMutableArray *)internal->children insertObject: child atIndex: index];
|
||||||
internal->childrenHaveMutated = YES;
|
// internal->childrenHaveMutated = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index
|
- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index
|
||||||
|
@ -235,7 +243,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
||||||
- (void) removeChildAtIndex: (NSUInteger)index
|
- (void) removeChildAtIndex: (NSUInteger)index
|
||||||
{
|
{
|
||||||
[(NSMutableArray *)internal->children removeObjectAtIndex: index];
|
[(NSMutableArray *)internal->children removeObjectAtIndex: index];
|
||||||
internal->childrenHaveMutated = YES;
|
// internal->childrenHaveMutated = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setChildren: (NSArray*)children
|
- (void) setChildren: (NSArray*)children
|
||||||
|
@ -271,6 +279,26 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
||||||
return internal->xmlData;
|
return internal->xmlData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) XMLStringWithOptions: (NSUInteger)options
|
||||||
|
{
|
||||||
|
NSMutableString *string = [NSMutableString string];
|
||||||
|
NSEnumerator *en = [internal->children objectEnumerator];
|
||||||
|
id obj = nil;
|
||||||
|
|
||||||
|
[string appendString: @"<?xml version=\"1.0\""];
|
||||||
|
if (YES == internal->standalone)
|
||||||
|
{
|
||||||
|
[string appendString: @" standalone=\"yes\""];
|
||||||
|
}
|
||||||
|
[string appendString: @"?>\n"];
|
||||||
|
|
||||||
|
while ((obj = [en nextObject]) != nil)
|
||||||
|
{
|
||||||
|
[string appendString: [obj XMLStringWithOptions: options]];
|
||||||
|
}
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
- (id) objectByApplyingXSLT: (NSData*)xslt
|
- (id) objectByApplyingXSLT: (NSData*)xslt
|
||||||
arguments: (NSDictionary*)arguments
|
arguments: (NSDictionary*)arguments
|
||||||
error: (NSError**)error
|
error: (NSError**)error
|
||||||
|
@ -311,17 +339,18 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
||||||
qualifiedName: (NSString *)qualifiedName
|
qualifiedName: (NSString *)qualifiedName
|
||||||
attributes: (NSDictionary *)attributeDict
|
attributes: (NSDictionary *)attributeDict
|
||||||
{
|
{
|
||||||
|
NSXMLElement *lastElement = [internal->elementStack lastObject];
|
||||||
NSXMLElement *currentElement =
|
NSXMLElement *currentElement =
|
||||||
[[NSXMLElement alloc] initWithName: elementName];
|
[[NSXMLElement alloc] initWithName: elementName];
|
||||||
|
|
||||||
|
[lastElement addChild: currentElement];
|
||||||
[internal->elementStack addObject: currentElement];
|
[internal->elementStack addObject: currentElement];
|
||||||
|
[currentElement release];
|
||||||
if (internal->rootElement == nil)
|
if (internal->rootElement == nil)
|
||||||
{
|
{
|
||||||
[self setRootElement: currentElement];
|
[self setRootElement: currentElement];
|
||||||
}
|
}
|
||||||
|
[currentElement setAttributesAsDictionary: attributeDict];
|
||||||
[currentElement setAttributesAsDictionary:
|
|
||||||
attributeDict];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)parser:(NSXMLParser *)parser
|
- (void)parser:(NSXMLParser *)parser
|
||||||
|
|
|
@ -125,7 +125,16 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
||||||
|
|
||||||
- (void) setAttributesAsDictionary: (NSDictionary*)attributes
|
- (void) setAttributesAsDictionary: (NSDictionary*)attributes
|
||||||
{
|
{
|
||||||
ASSIGN(internal->attributes, [attributes mutableCopy]);
|
NSEnumerator *en = [attributes keyEnumerator];
|
||||||
|
NSString *key;
|
||||||
|
|
||||||
|
while ((key = [en nextObject]) != nil)
|
||||||
|
{
|
||||||
|
NSString *val = [attributes objectForKey: key];
|
||||||
|
NSXMLNode *attribute = [NSXMLNode attributeWithName: key
|
||||||
|
stringValue: val];
|
||||||
|
[self addAttribute: attribute];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray*) attributes
|
- (NSArray*) attributes
|
||||||
|
@ -214,13 +223,14 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
||||||
|
|
||||||
ASSIGN(internal->children, c);
|
ASSIGN(internal->children, c);
|
||||||
[c release];
|
[c release];
|
||||||
internal->childrenHaveMutated = YES;
|
// internal->childrenHaveMutated = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) addChild: (NSXMLNode*)child
|
- (void) addChild: (NSXMLNode*)child
|
||||||
{
|
{
|
||||||
|
[child setParent: self];
|
||||||
[internal->children addObject: child];
|
[internal->children addObject: child];
|
||||||
internal->childrenHaveMutated = YES;
|
// internal->childrenHaveMutated = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node
|
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node
|
||||||
|
|
Loading…
Reference in a new issue