Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6589637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:11:58+00:00 2026-05-25T17:11:58+00:00

<dict> <key>1208</key> <dict> <key>Track ID</key><integer>1208</integer> <key>Name</key><string>Kings And Queens</string> <key>Artist</key><string>30 Seconds To Mars</string> <key>Album Artist</key><string>30

  • 0
<dict>
<key>1208</key>
        <dict>
            <key>Track ID</key><integer>1208</integer>
            <key>Name</key><string>Kings And Queens</string>
            <key>Artist</key><string>30 Seconds To Mars</string>
            <key>Album Artist</key><string>30 Seconds to Mars</string>
            <key>Composer</key><string>Jared Leto</string>
            <key>Album</key><string>This Is War</string>
            <key>Genre</key><string>Pop</string>
            <key>Kind</key><string>MPEG audio file</string>
            <key>Size</key><integer>10634388</integer>
            <key>Total Time</key><integer>347820</integer>
            <key>Track Number</key><integer>1</integer>
            <key>Year</key><integer>2009</integer>
            <key>Date Modified</key><date>2011-09-05T21:03:08Z</date>
            <key>Date Added</key><date>2011-08-18T03:57:19Z</date>
            <key>Bit Rate</key><integer>244</integer>
            <key>Sample Rate</key><integer>44100</integer>
            <key>Comments</key><string> 00000000 00000210 000006F0 0000000000EA0000 00000000 00A22291 00000000 00000000 00000000 00000000 00000000 00000000</string>
            <key>Play Count</key><integer>1</integer>

        <key>Play Date</key><integer>3399116673</integer>
            <key>Play Date UTC</key><date>2011-09-17T09:34:33Z</date>
            <key>Persistent ID</key><string>BB3D5E86F5CAC255</string>
            <key>Track Type</key><string>File</string>
            <key>Location</key><string>file://localhost/D:/My%20Music/English%20songs/01-30_seconds_to_mars-kings_and_queens.mp3</string>
            <key>File Folder Count</key><integer>-1</integer>
            <key>Library Folder Count</key><integer>-1</integer>
        </dict>

…

..

I want to use xml.dom.minidom package to parse this file.

self.dom = xml.dom.minidom.parse(self.file)
self.name = self.dom.getElementsByTagName('dict')
print self.name[10].firstChild.data

This code does not seem to work. Basically what I want is to check the value of the second child of dict and then if it is the track I want get the location of the track.

Is there a way to get the dict node which satisfies my conditions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:11:59+00:00Added an answer on May 25, 2026 at 5:11 pm

    How about:

    import xml.dom.minidom as minidom
    dom = minidom.parse('test.xml')
    data={}
    for dct in dom.getElementsByTagName('dict'):
        keys=dct.getElementsByTagName('key')
        # key.nextSibling can be an integer or string or date element, or Text node
        # key.nextSibling.firstChild is a Text node or None
        vals=[key.nextSibling.firstChild for key in keys]
        # drill down to the text inside the keys and vals
        keys=[key.firstChild.data for key in keys]
        vals=[val.data if val else None for val in vals]
        data=dict(zip(keys,vals))
        if data['Track ID']=='1208':
            print(data['Location'])
            break
    

    which yields

    file://localhost/D:/My%20Music/English%20songs/01-30_seconds_to_mars-kings_and_queens.mp3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to group by on dict key >>> x [{'a': 10, 'b': 90},
Currently I'm using var x = dict.ContainsKey(key) ? dict[key] : defaultValue I'd like some
I am trying to sort a dict based on its key and return an
I have a dict, which I need to pass key/values as keyword arguments.. For
I'm trying to remove some items of a dict based on their key, here
I have a very long list of dictionaries with string indices and integer values.
Dictionary dict; what's the diff between dict.add(key, value) and dict[key] = value
The loop: var pattern = _dict[key]; string before; do { before = pattern; foreach
So I've got a comprehension to the effect of: dict((x.key, x.value) for x in
I have a simple interface with methods such as bool TryGetValue(string key, out string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.