• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa and CFXMLTreeCreateFromData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Cocoa and CFXMLTreeCreateFromData (From: daniel <email@hidden>)

  • Prev by Date: Re: Cocoa and CFXMLTreeCreateFromData
  • Next by Date: Re: Two ?'s: Default code for NSView & FileMerge problem
  • Previous by thread: Re: Cocoa and CFXMLTreeCreateFromData
  • Next by thread: New server
  • Index(es):
    • Date
    • Thread