Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML




On Nov 15, 2004, at 5:25 PM, Steve Mills wrote:

I've read the docs and I just don't understand. How can I take a .plist file, read and parse it, then iterate through each element?

A plist is not necessarily XML....it can be an old style plist fwiw.

The .plist root is an array, each element in the array is a dictionary. Somewhere in the docs it illustrates how to use CFXMLTreeCreateFromData, but the resulting tree was nil. I'm totally confused about all the nodes and trees and property lists. Anybody have some sample source?

Just a while ago we discussed this on the list, here's what i posted then.... (look for a thread titled "CFXML Parser Woes" for more info)



In a nutshell....

Use CFXMLTreeCreateFromData to get a CFXMLTree

call CFTreeGetChildCount on the tree to get the number of child elements

to get a given child element use CFTreeGetChildAtIndex

to get a node for the child element use CFXMLTreeGetNode

to get the name of the node use CFXMLNodeGetString

to get the the content of the node use CFXMLNodeGetString

Be sure to check for errors (NULL results), etc.



Bryan

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >XML (From: "Steve Mills" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.