Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-10-2009, 04:47 PM   #1 (permalink)
New Member
 
Join Date: Feb 2009
Posts: 79
Default Converting the text from a .plist file into an array

I have a .plist file that contains an array of dictionaries. Is there any way that I can take the text of this and turn it into an array? I can't use initWithContentsOfFile: because I don't have access to the file, just the text inside of it. For example, given the text below, how would you construct an array?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>Blah</key>
<integer>3</integer>
<key>Blah Blah 2</key>
<string>Text</string>
<key>Hey</key>
<false/>
<key>Test</key>
<string>Groceries</string>
</dict>
</array>
</plist>
__________________
Josh Holat Software
Check out my software at http://www.joshholat.com/iphoneapps.php
joshholat is offline   Reply With Quote
Old 06-11-2009, 01:54 AM   #2 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 246
Default

Well, you could save it to a file and then use initWithContentsOfFile.
linkmx is offline   Reply With Quote
Old 06-11-2009, 10:07 AM   #3 (permalink)
New Member
 
Join Date: Feb 2009
Posts: 79
Default

Quote:
Originally Posted by linkmx View Post
Well, you could save it to a file and then use initWithContentsOfFile.
Yeah, I tried that but [NSString writeToFile:atomically:] is deprecated for strings. So I tried putting the string into an NSMutableArray, but then that changes the < to &lt and what not...
__________________
Josh Holat Software
Check out my software at http://www.joshholat.com/iphoneapps.php
joshholat is offline   Reply With Quote
Old 06-11-2009, 05:41 PM   #4 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 94
Default

what exactly do you want the array to look like? separated by newlines or something? I'm not sure what you're trying to accomplish here.
yezaev is offline   Reply With Quote
Reply

Bookmarks

Tags
array, contents, plist

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 233
16 members and 217 guests
ADY, Alsahir, cacao, dacapo, Dani77, Desert Diva, djohnson, F_Bryant, HemiMG, jansan, M@realobjects, MarkC, prchn4christ, smethorst, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,762
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:52 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0