Example #1
0
def __handleDictElement__(dictElement):
    d = dict()
    for keyElement in xmlutil.getChildrenByTagName(dictElement, 'key'):
        key = keyElement.firstChild.data
        valueElement = xmlutil.nextSiblingElement(keyElement)
        d[key] = __handleValueElement__(valueElement)
    return d
Example #2
0
def __parseItunesXml__(xmlFile):
    xmldoc = minidom.parse(xmlFile)
    assert xmldoc.documentElement.tagName == 'plist'
    rootDictElement = xmlutil.getChildrenByTagName(xmldoc.documentElement, 'dict').next()
    assert xmlutil.nextSiblingElement(rootDictElement) == None

    rootDict = __handleDictElement__(rootDictElement)

    tracksDict = rootDict['Tracks']

    return tracksDict