I'm trying to get my head around parsing with SAX and thought a good place to start was the TopSongs example found at the iPhone Dev Center. I get most of it but when it comes to reaching Attributes and Values within a node I can't find a good example anywhere. The XML has a path to a URL for the coverArt. And the XML node looks like this.
<itms:coverArt height="60" width="60">http://a1.phobos.apple.com/us/r1000/026/Music/aa/aa/27/mzi.pbxnbfvw.60x60-50.jpg</itms:coverArt>
What I've tried is this for the startElement…
((prefix != NULL && !strncmp((const char *)prefix, kName_Itms, kLength_Itms)) &&
(!strncmp((const char *)localname, kName_CoverArt, kLength_Item) &&
!strncmp((const char *)attributes, kAttributeName_CoverArt, kAttributeLength_CoverArt) &&
!strncmp((const char *)attributes, kValueName_CoverArt, kValueLength_CoverArt) ||
!strncmp((const char *)localname, kName_Artist, kLength_Artist) ||
and picking it up again with just the localname at the end like this.
if (!strncmp((const char *)localname, kName_CoverArt, kLength_CoverArt)) { importer.currentSong.coverArt = [NSURL URLWithString:importer.currentString];
The trace is -[Song setCoverArt:]: unrecognized selector sent to instance.