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 9005781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:14:11+00:00 2026-06-16T01:14:11+00:00

So I want to scan a large XML file (40mb) and as far as

  • 0

So I want to scan a large XML file (40mb) and as far as I understand I should use NSXMLParser to reduce the memory footprint. I want to check each song for a couple things, then if it passes all the criteria, write the songs into a new xml file.

I can load it in with NSXMLParser and do some basic reading of the file. So Im wondering how do I save each song as a temporary variable? And what kind of object should it be saved as (Im assuming something mutable, so I can keep adding more songs to the file before I write it to file).

    <key>Tracks</key>
<dict>
    <key>11072</key>
    <dict>
        <key>Track ID</key><integer>1107</integer>
        <key>Name</key><string>Kids with Guns (Hot Chip Remix)</string>
        <key>Artist</key><string>Gorillaz</string>
        <key>Album</key><string>D-Sides</string>
        <key>Genre</key><string>Britpop</string>
        <key>Kind</key><string>MPEG audio file</string>
        <key>Size</key><integer>844299</integer>
        <key>Total Time</key><integer>42971</integer>
        <key>Disc Number</key><integer>2</integer>
        <key>Disc Count</key><integer>2</integer>
        <key>Track Number</key><integer>6</integer>
        <key>Track Count</key><integer>9</integer>
        <key>Year</key><integer>2007</integer>
        <key>Date Modified</key><date>2008-10-30T02:44:58Z</date>
        <key>Date Added</key><date>2007-12-25T21:54:16Z</date>
        <key>Bit Rate</key><integer>153</integer>
        <key>Sample Rate</key><integer>44100</integer>
        <key>Comments</key><string> __FIXED__U74A0ECA</string>
        <key>Play Count</key><integer>1</integer>
        <key>Play Date</key><integer>3292750639</integer>
        <key>Play Date UTC</key><date>2008-05-04T20:57:19Z</date>
        <key>Skip Count</key><integer>1</integer>
        <key>Skip Date</key><date>2008-02-09T06:17:30Z</date>
        <key>Artwork Count</key><integer>2</integer>
        <key>Persistent ID</key><string>74A0ECAC8D</string>
        <key>Track Type</key><string>File</string>
        <key>Location</key><string>file://xxxxx/x/iTunes/Music/Gorillaz/D-Sides/2-06%20Kids%20with%20Guns%20(Hot%20Chip%20Remix).mp3</string>
        <key>File Folder Count</key><integer>5</integer>
        <key>Library Folder Count</key><integer>1</integer>
    </dict>
  • 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-06-16T01:14:12+00:00Added an answer on June 16, 2026 at 1:14 am

    Use any kind of object you like. You could use a dictionary, or you could make up your own class that reflects the structure that’s convenient for you and reflects the structure of the data you’re extracting. An obvious technique is that your top-level parser delegate has a property that’s an NSMutableArray so you can just add things to it as you obtain them, and then the caller can fetch the resulting value, as I do in this code:

    NSURL* url = // obtain xml URL
    NSXMLParser* parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
    MyPeopleParser* people = [[MyPeopleParser alloc] init];
    [parser setDelegate: people];
    [parser parse];
    

    MyPeopleParser has an NSMutableArray of people called people. So now we can just fetch the value of that property (people.people, sorry about that). The array is now full of Person objects. But all of that is just an implementation detail. If you’ve figured out how to use NSXMLParser you’re so far ahead of the game that the rest is gravy.

    I’m not quite sure what you mean about writing to a file; the XML is a file. However, in my case I make my Person class archivable, so an NSArray of Person objects can be written directly to disk as a .plist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to scan a folder of effects and check if each file is
I want the program to check how many large boxes are needed, then use
I want to scan FAT32 disk (I just need file path and file name)
I have a very large xml file which I load as a string so
I want to scan a large network, for example 10.10.0.0/16 and I'm looking for
I want to scan a PowerPoint 2007 file, but I'm trying to do it
I have some large ASCII images that I want to check are symmetrical. Say
In order to localize strings used within my javascript, I want scan all my
I want to Scan QR codes on button Click, problem is when I run
I an using Zbar SDK and want to scan QRcode and barcode in my

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.