* Headers/Foundation/NSXMLDocument.h

* Headers/Foundation/NSXMLElement.h
	* Headers/Foundation/NSXMLNode.h: Move declarations.
	* Source/NSXMLDocument.m: Correct parsing issues.
	* Source/NSXMLElement.m: Remove local declaration of _children
	* Source/NSXMLNode.m: Remove internal.  Move all declarations here
	directly.
	
2012-01-03 14:22-EST Gregory John Casamento <greg.casamento@gmail.com>



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34408 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2012-01-03 21:42:33 +00:00
parent 0b7ae8929b
commit 9a24dd2985
7 changed files with 73 additions and 62 deletions

View file

@ -43,7 +43,6 @@
RELEASE(_encoding);
RELEASE(_version);
RELEASE(_docType);
RELEASE(_children);
RELEASE(_URI);
RELEASE(_MIMEType);
RELEASE(_elementStack);
@ -90,13 +89,16 @@
if (parser != nil)
{
_standalone = YES;
_children = [[NSMutableArray alloc] initWithCapacity: 10];
_elementStack = [[NSMutableArray alloc] initWithCapacity: 10];
ASSIGN(_xmlData, data);
[parser setDelegate: self];
[parser parse];
RELEASE(parser);
}
else
{
return nil;
}
}
return self;
}
@ -110,9 +112,13 @@
element,
self];
}
self = [self initWithData: nil options: 0 error: 0];
self = [self init];
if (self != nil)
{
_standalone = YES;
_children = [[NSMutableArray alloc] initWithCapacity: 10];
_elementStack = [[NSMutableArray alloc] initWithCapacity: 10];
[self setRootElement: (NSXMLNode*)element];
}
return self;
@ -199,7 +205,7 @@
{
[child setParent: self];
[(NSMutableArray *)_children insertObject: child atIndex: index];
_childrenHaveMutated = YES;
// _childrenHaveMutated = YES;
}
- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index
@ -215,8 +221,8 @@
- (void) removeChildAtIndex: (NSUInteger)index
{
[(NSMutableArray *)_children removeObjectAtIndex: index];
_childrenHaveMutated = YES;
[_children removeObjectAtIndex: index];
// _childrenHaveMutated = YES;
}
- (void) setChildren: (NSArray*)children
@ -288,7 +294,13 @@
NSEnumerator *en = [_children objectEnumerator];
id obj = nil;
[string appendString: @"<?xml version=\"1.0\"?>"];
[string appendString: @"<?xml version=\"1.0\""];
if(_standalone == YES)
{
[string appendString: @" standalone=\"yes\""];
}
[string appendString: @"?>\n"];
while((obj = [en nextObject]) != nil)
{
[string appendString: [obj XMLStringWithOptions: options]];
@ -306,9 +318,11 @@
qualifiedName: (NSString *)qualifiedName
attributes: (NSDictionary *)attributeDict
{
NSXMLElement *lastElement = [_elementStack lastObject];
NSXMLElement *currentElement =
[[NSXMLElement alloc] initWithName: elementName];
[lastElement addChild: currentElement];
[_elementStack addObject: currentElement];
if (_rootElement == nil)
{