Blame | Last modification | View Log | Download | RSS feed
# This version works on the generic plist form# We want the dict/dict/dictdepth = 0count = 0songs = vector("list", 1300)songNode =function(parser, node){count <<- count + 1songs[[count]] <<- node}class(songNode) = c("XMLParserContextFunction", "SAXBranchFunction")dict =function(parser, node, ...){print(depth)if(depth == 2) {# return the songNode function so that it will be used as a branch# function for this <dict> node, i.e. will be invokedreturn(songNode)} elsedepth <<- depth + 1TRUE}xmlEventParse("~/itunes.xml", handlers = list(dict = dict), saxVersion = 2L)