Parsing NSXMLNode Attributes in Cocoa

Posted by Jeffrey Kern on Stack Overflow See other posts from Stack Overflow or by Jeffrey Kern
Published on 2010-06-02T22:16:26Z Indexed on 2010/06/03 0:34 UTC
Read the original article Hit count: 256

Filed under:
|
|

Hello everyone,

Given the following XML file:

    <?xml version="1.0" encoding="UTF-8"?>
<application name="foo">
 <movie name="tc" english="tce.swf" chinese="tcc.swf" a="1" b="10" c="20" />
 <movie name="tl" english="tle.swf" chinese="tlc.swf" d="30" e="40" f="50" />
</application>

How can I access the attributes ("english", "chinese", "name", "a", "b", etc.) and their associated values of the MOVIE nodes? I currently have in Cocoa the ability to traverse these nodes, but I'm at a loss at how I can access the data in the MOVIE NSXMLNodes.

Is there a way I can dump all of the values from each NSXMLNode into a Hashtable and retrieve values that way?

Am using NSXMLDocument and NSXMLNodes.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about Xml