mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Merge branch 'master' of github.com:gnustep/libs-base into NSSecureCoding_branch
This commit is contained in:
commit
264811b3d0
13 changed files with 809 additions and 596 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2020-05-07 Frederik Seiffert <frederik@algoriddim.com>
|
||||
|
||||
* Headers/Foundation/NSLocale.h:
|
||||
* Source/NSLocale.m:
|
||||
Use "instancetype" for instance-returning methods. Fix method
|
||||
signature of -displayNameForKey:value:.
|
||||
|
||||
2020-05-05 Frederik Seiffert <frederik@algoriddim.com>
|
||||
|
||||
* Headers/Foundation/NSXMLParser.h:
|
||||
* Headers/GNUstepBase/GSXML.h:
|
||||
* Source/Additions/GSXML.m:
|
||||
* Source/NSXMLParser.m:
|
||||
* Tests/base/NSXMLParser/parse.m:
|
||||
Implement -[NSXMLParser initWithStream:].
|
||||
|
||||
2020-04-26 Fred Kiefer <fredkiefer@gmx.de>
|
||||
|
||||
* Source/NSLocale.m: Respect NSLocaleCalendarIdentifier if
|
||||
|
|
|
@ -156,7 +156,7 @@ GS_EXPORT NSString * const NSISO8601Calendar;
|
|||
|
||||
/** Returns the current locale information.
|
||||
*/
|
||||
+ (id) currentLocale;
|
||||
+ (instancetype) currentLocale;
|
||||
|
||||
/** Returns an array of NSString representing all known country codes.
|
||||
*/
|
||||
|
@ -190,7 +190,7 @@ GS_EXPORT NSString * const NSISO8601Calendar;
|
|||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
/** Returns a locale initialised with the given locale identifier.
|
||||
*/
|
||||
+ (id) localeWithLocaleIdentifier:(NSString *)string;
|
||||
+ (instancetype) localeWithLocaleIdentifier:(NSString *)string;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||
|
@ -202,7 +202,7 @@ GS_EXPORT NSString * const NSISO8601Calendar;
|
|||
|
||||
/** Returns the the system locale.
|
||||
*/
|
||||
+ (id) systemLocale;
|
||||
+ (instancetype) systemLocale;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
/** Returns the windows locale code corresponding to the staqndard locale
|
||||
|
@ -216,12 +216,12 @@ GS_EXPORT NSString * const NSISO8601Calendar;
|
|||
* on the basis that it represents information whose type is specified by
|
||||
* the key.
|
||||
*/
|
||||
- (NSString *) displayNameForKey: (id)key value: (id)value;
|
||||
- (NSString *) displayNameForKey: (NSString *)key value: (id)value;
|
||||
|
||||
/** Initialises the receiver to be the locale specified by the identifier.
|
||||
* This may result in replacement of the receiver by an existing locale.
|
||||
*/
|
||||
- (id) initWithLocaleIdentifier: (NSString *)string;
|
||||
- (instancetype) initWithLocaleIdentifier: (NSString *)string;
|
||||
|
||||
/** Returns the canonical identifier for the receiver (which
|
||||
* may differ from the identifgier used to create the receiver
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
@class NSData, NSDictionary, NSError, NSString, NSURL;
|
||||
@class NSData, NSDictionary, NSError, NSInputStream, NSString, NSURL;
|
||||
|
||||
/**
|
||||
* Domain for errors
|
||||
|
@ -100,12 +100,17 @@ GS_EXPORT NSString* const NSXMLParserErrorDomain;
|
|||
/**
|
||||
* Convenience method fetching data from anURL.<br />
|
||||
*/
|
||||
- (id) initWithContentsOfURL: (NSURL*)anURL;
|
||||
- (instancetype) initWithContentsOfURL: (NSURL*)anURL;
|
||||
|
||||
/** <init />
|
||||
* Initialises the parser with the specified xml data.
|
||||
*/
|
||||
- (id) initWithData: (NSData*)data;
|
||||
- (instancetype) initWithData: (NSData*)data;
|
||||
|
||||
/**
|
||||
* Initialises the parser with the specified input stream.
|
||||
*/
|
||||
- (instancetype) initWithStream: (NSInputStream*)stream;
|
||||
|
||||
/**
|
||||
* Parses the supplied data and returns YES on success, NO otherwise.
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSStream.h>
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
@ -222,6 +223,8 @@ extern "C" {
|
|||
withContentsOfURL: (NSURL*)url;
|
||||
- (id) initWithSAXHandler: (GSSAXHandler*)handler
|
||||
withData: (NSData*)data;
|
||||
- (id) initWithSAXHandler: (GSSAXHandler*)handler
|
||||
withInputStream: (NSInputStream*)stream;
|
||||
|
||||
- (BOOL) keepBlanks: (BOOL)yesno;
|
||||
- (NSInteger) lineNumber;
|
||||
|
|
1
MISSING
1
MISSING
|
@ -910,7 +910,6 @@ NSXMLNodeOptions:
|
|||
NSXMLParser:
|
||||
@class NSInputStream
|
||||
|
||||
- initWithStream:
|
||||
- parseError
|
||||
-------------------------------------------------------------
|
||||
NSZone:
|
||||
|
|
|
@ -172,6 +172,19 @@ setupCache()
|
|||
}
|
||||
}
|
||||
|
||||
static int xmlNSInputStreamReadCallback(void *context, char *buffer, int len)
|
||||
{
|
||||
NSInputStream *stream = (NSInputStream *)context;
|
||||
return [stream read: (uint8_t *)buffer maxLength: len];
|
||||
}
|
||||
|
||||
static int xmlNSInputStreamCloseCallback (void *context)
|
||||
{
|
||||
NSInputStream *stream = (NSInputStream *)context;
|
||||
[stream close];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static xmlParserInputPtr
|
||||
loadEntityFunction(const unsigned char *url, const unsigned char *eid,
|
||||
void *ctx);
|
||||
|
@ -2102,6 +2115,31 @@ static NSString *endMarker = @"At end of incremental parse";
|
|||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Initialisation of a new Parser with SAX handler (if not nil)
|
||||
* by calling -initWithSAXHandler:
|
||||
* </p>
|
||||
* <p>
|
||||
* Sets the input source for the parser to be the specified input stream,
|
||||
* so parsing of the entire document will be performed rather than
|
||||
* incremental parsing.
|
||||
* </p>
|
||||
*/
|
||||
- (id) initWithSAXHandler: (GSSAXHandler*)handler
|
||||
withInputStream: (NSInputStream*)stream
|
||||
{
|
||||
if (stream == nil || [stream isKindOfClass: [NSInputStream class]] == NO)
|
||||
{
|
||||
NSLog(@"Bad NSInputStream passed to initialize GSXMLParser");
|
||||
DESTROY(self);
|
||||
return nil;
|
||||
}
|
||||
src = RETAIN(stream);
|
||||
self = [self initWithSAXHandler: handler];
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set and return the previous value for blank text nodes support.
|
||||
* ignorableWhitespace nodes are only generated when running
|
||||
|
@ -2167,7 +2205,8 @@ static NSString *endMarker = @"At end of incremental parse";
|
|||
return NO;
|
||||
}
|
||||
|
||||
if ([src isKindOfClass: [NSData class]])
|
||||
if ([src isKindOfClass: [NSData class]]
|
||||
|| [src isKindOfClass: [NSInputStream class]])
|
||||
{
|
||||
}
|
||||
else if ([src isKindOfClass: NSString_class])
|
||||
|
@ -2194,14 +2233,22 @@ static NSString *endMarker = @"At end of incremental parse";
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"source for [-parse] must be NSString, NSData or NSURL type");
|
||||
NSLog(@"Source for [-parse] must be NSString, NSData, NSInputStream, or"
|
||||
@" NSURL type");
|
||||
return NO;
|
||||
}
|
||||
|
||||
tmp = RETAIN(src);
|
||||
ASSIGN(src, endMarker);
|
||||
[self _parseChunk: tmp];
|
||||
[self _parseChunk: nil];
|
||||
if ([tmp isKindOfClass: [NSInputStream class]])
|
||||
{
|
||||
xmlParseDocument(lib);
|
||||
}
|
||||
else
|
||||
{
|
||||
[self _parseChunk: tmp];
|
||||
[self _parseChunk: nil];
|
||||
}
|
||||
RELEASE(tmp);
|
||||
|
||||
if (((xmlParserCtxtPtr)lib)->wellFormed != 0
|
||||
|
@ -2382,7 +2429,19 @@ static NSString *endMarker = @"At end of incremental parse";
|
|||
{
|
||||
file = ".";
|
||||
}
|
||||
lib = (void*)xmlCreatePushParserCtxt([saxHandler lib], NULL, 0, 0, file);
|
||||
|
||||
if ([src isKindOfClass: [NSInputStream class]])
|
||||
{
|
||||
[(NSInputStream*)src open];
|
||||
lib = (void*)xmlCreateIOParserCtxt([saxHandler lib], NULL,
|
||||
xmlNSInputStreamReadCallback, xmlNSInputStreamCloseCallback,
|
||||
(void*)src, XML_CHAR_ENCODING_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
lib = (void*)xmlCreatePushParserCtxt([saxHandler lib], NULL, 0, 0, file);
|
||||
}
|
||||
|
||||
if (lib == NULL)
|
||||
{
|
||||
NSLog(@"Failed to create libxml parser context");
|
||||
|
|
|
@ -691,7 +691,7 @@ static NSRecursiveLock *classLock = nil;
|
|||
#endif
|
||||
}
|
||||
|
||||
- (NSString *) displayNameForKey: (id) key value: (id) value
|
||||
- (NSString *) displayNameForKey: (NSString *) key value: (id) value
|
||||
{
|
||||
#if GS_USE_ICU == 1
|
||||
int32_t length = 0;
|
||||
|
|
|
@ -2116,17 +2116,33 @@ GS_PRIVATE_INTERNAL(NSURLQueryItem)
|
|||
return AUTORELEASE(newQueryItem);
|
||||
}
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [self initWithName:nil value:nil];
|
||||
if(self != nil)
|
||||
{
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
value:(NSString *)value
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
GS_CREATE_INTERNAL(NSURLQueryItem);
|
||||
|
||||
ASSIGNCOPY(internal->_name, name);
|
||||
ASSIGNCOPY(internal->_value, value);
|
||||
}
|
||||
if(self != nil)
|
||||
{
|
||||
GS_CREATE_INTERNAL(NSURLQueryItem);
|
||||
if(name)
|
||||
{
|
||||
ASSIGNCOPY(internal->_name, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSIGN(internal->_name, @""); //OSX behaviour is to set an empty string for nil name property
|
||||
}
|
||||
ASSIGNCOPY(internal->_value, value);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -2225,14 +2241,14 @@ static NSCharacterSet *queryItemCharSet = nil;
|
|||
// Creating URL components...
|
||||
+ (instancetype) componentsWithString: (NSString *)urlString
|
||||
{
|
||||
return [[NSURLComponents alloc] initWithString: urlString];
|
||||
return AUTORELEASE([[NSURLComponents alloc] initWithString: urlString]);
|
||||
}
|
||||
|
||||
+ (instancetype) componentsWithURL: (NSURL *)url
|
||||
resolvingAgainstBaseURL: (BOOL)resolve
|
||||
{
|
||||
return [[NSURLComponents alloc] initWithURL: url
|
||||
resolvingAgainstBaseURL: resolve];
|
||||
return AUTORELEASE([[NSURLComponents alloc] initWithURL: url
|
||||
resolvingAgainstBaseURL: resolve]);
|
||||
}
|
||||
|
||||
- (instancetype) init
|
||||
|
@ -2256,12 +2272,16 @@ static NSCharacterSet *queryItemCharSet = nil;
|
|||
|
||||
- (instancetype) initWithString: (NSString *)URLString
|
||||
{
|
||||
self = [self init];
|
||||
if (self != nil)
|
||||
//OSX behavior is to return nil for a string which cannot be used to initialize valid NSURL object
|
||||
NSURL* url = [NSURL URLWithString:URLString];
|
||||
if(url)
|
||||
{
|
||||
[self setString: URLString];
|
||||
return [self initWithURL:url resolvingAgainstBaseURL:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype) initWithURL: (NSURL *)url
|
||||
|
@ -2454,7 +2474,7 @@ static NSCharacterSet *queryItemCharSet = nil;
|
|||
[self setUser: [url user]];
|
||||
[self setPassword: [url password]];
|
||||
[self setPath: [url path]];
|
||||
[self setQuery: [url query]];
|
||||
[self setPercentEncodedQuery:[url query]];
|
||||
[self setFragment: [url fragment]];
|
||||
}
|
||||
|
||||
|
|
1103
Source/NSXMLParser.m
1103
Source/NSXMLParser.m
File diff suppressed because it is too large
Load diff
|
@ -339,6 +339,23 @@ GSPathHandling("right");
|
|||
PASS_EQUAL([rel absoluteString], @"data:,$2A", "relative data URL works");
|
||||
PASS_EQUAL([rel baseURL], nil, "Base URL of relative data URL is nil");
|
||||
|
||||
///NSURLQueryItem
|
||||
|
||||
//OSX behavior is to return query item with an empty string name
|
||||
NSURLQueryItem* item = [[NSURLQueryItem alloc] init];
|
||||
PASS_EQUAL(item.name, @"", "NSURLQueryItem.name should not be nil");
|
||||
PASS_EQUAL(item.value, nil, "NSURLQueryItem.value should be nil");
|
||||
|
||||
//OSX behavior is to return query item with an empty string name
|
||||
item = [[NSURLQueryItem alloc] initWithName:nil value:nil];
|
||||
PASS_EQUAL(item.name, @"", "NSURLQueryItem.name should not be nil");
|
||||
PASS_EQUAL(item.value, nil, "NSURLQueryItem.value should be nil");
|
||||
|
||||
item = [[NSURLQueryItem alloc] initWithName:@"myName" value:@"myValue"];
|
||||
PASS_EQUAL(item.name, @"myName", "NSURLQueryItem.name should not be nil");
|
||||
PASS_EQUAL(item.value, @"myValue", "NSURLQueryItem.value should not be nil");
|
||||
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,23 @@ int main()
|
|||
"set query to item containing ampersand")
|
||||
PASS_EQUAL([components percentEncodedQuery], @"%26",
|
||||
"percent encoded query item encodes ampersand")
|
||||
|
||||
//NSURLQueryItem percent encoding/decoding test
|
||||
NSString* urlString = @"http://domain/?%D0%90%D0%B0%D0%91%D0%B1=%D0%90%D0%B0%D0%91%D0%B1";
|
||||
NSString* cyrillicStr = @"\U00000410\U00000430\U00000411\U00000431";
|
||||
NSURLComponents* components = [NSURLComponents componentsWithString:urlString];
|
||||
NSURLQueryItem* item = [[components queryItems] lastObject];
|
||||
PASS_EQUAL(item.name, cyrillicStr, "Should return decoded query item name from url");
|
||||
PASS_EQUAL(item.value, cyrillicStr, "Should return decoded query item value from url");
|
||||
|
||||
item = [NSURLQueryItem queryItemWithName:cyrillicStr value:cyrillicStr];
|
||||
[components setQueryItems:[NSArray arrayWithObject:item]];
|
||||
PASS_EQUAL([components string], urlString, "Encoded url string from unencoded item");
|
||||
PASS_EQUAL([components URL], [NSURL URLWithString:urlString], "Encoded url query part from unencoded item");
|
||||
|
||||
NSString* invalidUrlString = @"\U00000410\U00000430\U00000411\U00000431";
|
||||
PASS_EQUAL([NSURL URLWithString:invalidUrlString], nil, "nil NSURL from invalid string")
|
||||
PASS_EQUAL([NSURLComponents componentsWithString:invalidUrlString], nil, "nil NSComponents from invalid string")
|
||||
|
||||
END_SET("components")
|
||||
|
||||
|
|
|
@ -5,10 +5,16 @@ int main()
|
|||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSXMLParser *parser;
|
||||
Class c = NSClassFromString(@"GSSloppyXMLParser");
|
||||
|
||||
parser = [c new];
|
||||
test_alloc(@"GSSloppyXMLParser");
|
||||
test_NSObject(@"GSSloppyXMLParser", [NSArray arrayWithObject: parser]);
|
||||
|
||||
parser = [NSXMLParser new];
|
||||
test_alloc(@"NSXMLParser");
|
||||
test_NSObject(@"NSXMLParser", [NSArray arrayWithObject: parser]);
|
||||
|
||||
[arp release]; arp = nil;
|
||||
|
||||
/* Don't release the parser ... it appears that on OSX there is a bug in
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#import "ObjectTesting.h"
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSFileManager.h>
|
||||
#import <Foundation/NSStream.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
#import <Foundation/NSXMLParser.h>
|
||||
#include <string.h>
|
||||
|
@ -236,17 +237,10 @@ static BOOL setShouldReportNamespacePrefixes = YES;
|
|||
static BOOL setShouldResolveExternalEntities = NO;
|
||||
|
||||
static BOOL
|
||||
testParse(NSData *xml, NSString *expect)
|
||||
testParser(NSXMLParser *parser, NSString *expect)
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
Handler *handler;
|
||||
NSXMLParser *parser;
|
||||
Class c = NSClassFromString(@"GSSloppyXMLParser");
|
||||
|
||||
c = Nil;
|
||||
if (Nil == c) c = [NSXMLParser class];
|
||||
parser = [[c alloc] initWithData: xml];
|
||||
|
||||
Handler *handler;
|
||||
|
||||
[parser setShouldProcessNamespaces: setShouldProcessNamespaces];
|
||||
[parser setShouldReportNamespacePrefixes: setShouldReportNamespacePrefixes];
|
||||
[parser setShouldResolveExternalEntities: setShouldResolveExternalEntities];
|
||||
|
@ -257,7 +251,6 @@ testParse(NSData *xml, NSString *expect)
|
|||
{
|
||||
NSLog(@"Parsing failed: %@ at %ld on %ld", [parser parserError],
|
||||
(long)[parser columnNumber], (long)[parser lineNumber]);
|
||||
[arp release];
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
|
@ -265,22 +258,55 @@ testParse(NSData *xml, NSString *expect)
|
|||
if (NO == [[handler description] isEqual: expect])
|
||||
{
|
||||
NSLog(@"######## Expected:\n%@\n######## Parsed:\n%@\n########\n",
|
||||
expect, [handler description]);
|
||||
[arp release];
|
||||
expect, [handler description]);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
[arp release];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
testParseCString(const char *xmlBytes, NSString *expect)
|
||||
testParseData(NSData *xml, NSString *expect, BOOL strict)
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSXMLParser *parser;
|
||||
Class c = NSClassFromString(@"GSSloppyXMLParser");
|
||||
BOOL result;
|
||||
|
||||
if (strict) c = Nil;
|
||||
if (Nil == c) c = [NSXMLParser class];
|
||||
parser = [[c alloc] initWithData: xml];
|
||||
result = testParser(parser, expect);
|
||||
|
||||
[arp release];
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
testParseCString(const char *xmlBytes, NSString *expect, BOOL strict)
|
||||
{
|
||||
NSData *xml;
|
||||
|
||||
xml = [NSData dataWithBytes: xmlBytes length: strlen(xmlBytes)];
|
||||
return testParse(xml, expect);
|
||||
return testParseData(xml, expect, strict);
|
||||
}
|
||||
|
||||
static BOOL
|
||||
testParseStream(NSInputStream *stream, NSString *expect, BOOL strict)
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSXMLParser *parser;
|
||||
Class c = NSClassFromString(@"GSSloppyXMLParser");
|
||||
BOOL result;
|
||||
|
||||
if (strict) c = Nil;
|
||||
if (Nil == c) c = [NSXMLParser class];
|
||||
parser = [[c alloc] initWithStream: stream];
|
||||
result = testParser(parser, expect);
|
||||
|
||||
[arp release];
|
||||
return result;
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -295,8 +321,12 @@ int main()
|
|||
NSString *e1 =
|
||||
@"parserDidStartDocument:\nparser:didStartElement:namespaceURI:qualifiedName:attributes: test test {\n x = 1;\n}\nparser:didEndElement:namespaceURI:qualifiedName: test test\nparserDidEndDocument:\n";
|
||||
|
||||
PASS((testParseCString(x1, e1)), "simple document 1")
|
||||
PASS((testParseCString(x1e, e1)), "simple document 1 without header")
|
||||
PASS((testParseCString(x1, e1, YES)), "simple document 1 (strict)")
|
||||
PASS((testParseCString(x1, e1, NO)), "simple document 1 (sloppy)")
|
||||
PASS((testParseCString(x1e, e1, YES)),
|
||||
"simple document 1 (strict) without header")
|
||||
PASS((testParseCString(x1e, e1, NO)),
|
||||
"simple document 1 (sloppy) without header")
|
||||
|
||||
/* Now perform any tests using .xml and .result pairs of files in
|
||||
* the ParseData subdirectory.
|
||||
|
@ -305,18 +335,33 @@ int main()
|
|||
while ((xmlName = [dir nextObject]) != nil)
|
||||
{
|
||||
if ([[xmlName pathExtension] isEqualToString: @"xml"])
|
||||
{
|
||||
NSString *xmlPath;
|
||||
{
|
||||
NSString *xmlPath;
|
||||
NSData *xmlData;
|
||||
NSString *result;
|
||||
NSInputStream *stream;
|
||||
|
||||
xmlPath = [@"ParseData" stringByAppendingPathComponent: xmlName];
|
||||
str = [xmlPath stringByDeletingPathExtension];
|
||||
str = [str stringByAppendingPathExtension: @"result"];
|
||||
xmlPath = [@"ParseData" stringByAppendingPathComponent: xmlName];
|
||||
str = [xmlPath stringByDeletingPathExtension];
|
||||
str = [str stringByAppendingPathExtension: @"result"];
|
||||
xmlData = [NSData dataWithContentsOfFile: xmlPath];
|
||||
|
||||
result = [NSString stringWithContentsOfFile: str];
|
||||
PASS((testParse(xmlData, result)), "%s", [xmlName UTF8String])
|
||||
}
|
||||
PASS((testParseData(xmlData, result, YES)),
|
||||
"parse data (strict): %s", [xmlName UTF8String])
|
||||
|
||||
result = [NSString stringWithContentsOfFile: str];
|
||||
PASS((testParseData(xmlData, result, NO)),
|
||||
"parse data (sloppy): %s", [xmlName UTF8String])
|
||||
|
||||
stream = [NSInputStream inputStreamWithFileAtPath:xmlPath];
|
||||
PASS((testParseStream(stream, result, YES)),
|
||||
"parse stream (strict): %s", [xmlName UTF8String])
|
||||
|
||||
stream = [NSInputStream inputStreamWithFileAtPath:xmlPath];
|
||||
PASS((testParseStream(stream, result, NO)),
|
||||
"parse stream (sloppy): %s", [xmlName UTF8String])
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -335,7 +380,8 @@ parserDidEndDocument:\n\
|
|||
@"<file>&&foo;A</file>", [mgr currentDirectoryPath]];
|
||||
|
||||
dat = [str dataUsingEncoding: NSUTF8StringEncoding];
|
||||
PASS((testParse(dat, exp)), "external entity")
|
||||
PASS((testParseData(dat, exp, YES)), "external entity (strict)")
|
||||
PASS((testParseData(dat, exp, YES)), "external entity (sloppy)")
|
||||
}
|
||||
|
||||
[arp release]; arp = nil;
|
||||
|
|
Loading…
Reference in a new issue