mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
* ChangeLog
* Source/NSXMLDocument.m * Source/NSXMLElement.m * Source/NSXMLNode.m: Implement copyWithZone:, correct issues with previous revert. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34428 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dd3807023e
commit
a3d5150a84
4 changed files with 89 additions and 17 deletions
|
@ -31,6 +31,17 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
|
||||
#import <Foundation/NSXMLParser.h>
|
||||
|
||||
@interface NSXMLDocument (Debug)
|
||||
- (id) elementStack;
|
||||
@end
|
||||
|
||||
@implementation NSXMLDocument (Debug)
|
||||
- (id) elementStack
|
||||
{
|
||||
return internal->elementStack;
|
||||
}
|
||||
@end
|
||||
|
||||
// Forward declaration of interface for NSXMLParserDelegate
|
||||
@interface NSXMLDocument (NSXMLParserDelegate)
|
||||
@end
|
||||
|
@ -112,16 +123,15 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
{
|
||||
NSXMLParser *parser = [[NSXMLParser alloc] initWithData: data];
|
||||
|
||||
internal->standalone = YES;
|
||||
internal->elementStack = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
ASSIGN(internal->xmlData, data);
|
||||
if (nil == parser)
|
||||
{
|
||||
DESTROY(self);
|
||||
}
|
||||
else
|
||||
{
|
||||
internal->standalone = YES;
|
||||
internal->elementStack
|
||||
= [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
ASSIGN(internal->xmlData, data);
|
||||
[parser setDelegate: self];
|
||||
[parser parse];
|
||||
RELEASE(parser);
|
||||
|
@ -287,10 +297,12 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
return [self XMLDataWithOptions: NSXMLNodeOptionsNone];
|
||||
}
|
||||
|
||||
- (NSData*) XMLDataWithOptions: (NSUInteger)options
|
||||
- (NSData *) XMLDataWithOptions: (NSUInteger)options
|
||||
{
|
||||
// TODO: Apply options to data.
|
||||
return internal->xmlData;
|
||||
NSString *xmlString = [self XMLStringWithOptions: options];
|
||||
NSData *data = [NSData dataWithBytes: [xmlString UTF8String]
|
||||
length: [xmlString length]];
|
||||
return data;
|
||||
}
|
||||
|
||||
- (NSString *) XMLStringWithOptions: (NSUInteger)options
|
||||
|
@ -343,6 +355,16 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone *)zone
|
||||
{
|
||||
id c = [super copyWithZone: zone];
|
||||
[c setStandalone: internal->standalone];
|
||||
[c setRootElement: internal->rootElement];
|
||||
[c setDTD: internal->docType];
|
||||
[c setMIMEType: internal->MIMEType];
|
||||
return c;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSXMLDocument (NSXMLParserDelegate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue