Re: Cocoa and CFXMLTreeCreateFromData
Re: Cocoa and CFXMLTreeCreateFromData
- Subject: Re: Cocoa and CFXMLTreeCreateFromData
- From: Chris Parker <email@hidden>
- Date: Fri, 8 Feb 2002 14:14:19 -0800
On Friday, February 8, 2002, at 01:10 PM, daniel wrote:
has anyone got sample code showing how to get corefoundation's
CFXMLTreeCreateFromData to work from within a cocoa app; in
particular, working with xml data in NS(Mutable)Data form? i
cannot for the life of me get it to work; it always retuns null.
Well, the short answer is "just cast it:"
CFXMLTreeRef cfXMLTree;
NSString *path = @"test.plist";
NSMutableData *XMLData = [NSMutableData dataWithContentsOfFile:path];
cfXMLTree = CFXMLTreeCreateFromData(kCFAllocatorDefault,
(CFDataRef)XMLData, NULL, kCFXMLParserSkipWhitespace,
kCFXMLNodeCurrentVersion);
This seems to work for me. You can tune your use of the parser flags to
suit your requirements.
.chris
--
Chris Parker <email@hidden>
Cocoa Frameworks Engineer
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.