packrat/lib/x86_64-apple-darwin15.6.0/3.6.0/XML/examples/itunesSax1.R

# This works on the transformed version that has
# the <fieldName>value</fieldName> form
# rather than the generic
#  <dict><key>name</key><integer>12</integer>....</dict>
# for of a property/p list.
#
count = 0
songs = vector("list", 100)

song =
function(parser, node, ...)
{
  count <<- count + 1
  if(count == length(songs))
     xmlStopParser(parser)
  
  songs[[count]] <<- node

  TRUE
}

class(song)  = "XMLParserContextFunction"

xmlEventParse("itunes.xml", branches = list(song = song))
adnaniazi/krauseNiazi2019Analyses documentation built on June 9, 2019, 7:22 p.m.