mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 17:51:01 +00:00
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35528 72102866-910b-0410-8b05-ffd578937521
25 lines
943 B
Objective-C
25 lines
943 B
Objective-C
#import "ObjectTesting.h"
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
#import <Foundation/NSXMLDocument.h>
|
|
#import <Foundation/NSXMLElement.h>
|
|
|
|
int main()
|
|
{
|
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
|
NSString *docString = @"<root><node><![CDATA[How to read this text ?]]></node></root>";
|
|
NSData *data = [docString dataUsingEncoding: NSUTF8StringEncoding];
|
|
NSError *outError = nil;
|
|
NSXMLDocument *document = [[[NSXMLDocument alloc]
|
|
initWithData: data
|
|
options: (NSXMLNodePreserveCDATA | NSXMLNodePreserveWhitespace)
|
|
error: &outError] autorelease];
|
|
NSXMLElement *rootElement = [document rootElement];
|
|
NSXMLNode *childNode = [rootElement childAtIndex: 0];
|
|
NSString *cData = [childNode stringValue];
|
|
PASS_EQUAL(cData, @"How to read this text ?", "CDATA element is correct");
|
|
|
|
[arp release];
|
|
arp = nil;
|
|
|
|
return 0;
|
|
}
|