From: Chilkat Software Date: 2006-11-07T12:15:42+09:00 Subject: Re: REXML --=======AVGMAIL-454FFACB370E======= Content-Type: multipart/alternative; boundary="=====================_-1915831656==.ALT"; x-avg-checked=avg-ok-1C9D31A --=====================_-1915831656==.ALT Content-Type: text/plain; charset=us-ascii; format=flowed; x-avg-checked=avg-ok-1C9D31A I created a sample program to parse the iTunes XML using Chilkat XML here: http://www.example-code.com/ruby/ruby-parse-itunes-xml.asp Unfortunately, it only runs on Windows. (Sorry!) It is freeware however. Here's the example source. I suspect you won't have memory problems with it. If you try it, please let me know how fast it runs and whether it uses too much memory... require 'chilkat' # The Chilkat XML parser for Ruby is freeware. xml = Chilkat::CkXml.new() xml.LoadXmlFile("c:/temp/itunes.xml") # Search for this node: Tracks tracksKey = xml.SearchForContent(xml,"key","Tracks") # Assuming it's found, the node is the next sibling dict = tracksKey.NextSibling() # Loop over the child nodes... n = dict.NumChildrenHavingTag("dict") for i in 0..(n-1) trackRec = dict.GetNthChildWithTag("dict",i) print "Name: " + trackRec.GetChildExact("key","Name").NextSibling().content + "\n" print "Artist: " + trackRec.GetChildExact("key","Artist").NextSibling().content + "\n" print "Time: " + trackRec.GetChildExact("key","Total Time").NextSibling().content + "\n" end -Matt At 08:10 PM 11/6/2006, you wrote: >Assuming I go with the Ruby pull parser, how do I use this in my code. >I see from the link the code sample, but I have no idea how to throw >that into my code and make it work. Any suggestions. > >Thanks for the discussion so far. > >PS: idiot (slaps head). Yes it was 5-6meg not gig! > > > > > >-- >No virus found in this incoming message. >Checked by AVG Free Edition. >Version: 7.1.409 / Virus Database: 268.13.28/518 - Release Date: 11/4/2006 --=====================_-1915831656==.ALT Content-Type: text/html; charset=us-ascii; x-avg-checked=avg-ok-1C9D31A
I created a sample program to parse the iTunes XML using
Chilkat XML here:
http://www.example-code.com/ruby/ruby-parse-itunes-xml.asp

Unfortunately, it only runs on Windows.  (Sorry!)  It is freeware however.

Here's the example source.  I suspect you won't have memory problems with it.
If you try it, please let me know how fast it runs and whether it uses
too much memory...

require 'chilkat'

# The Chilkat XML parser for Ruby is freeware.

xml = Chilkat::CkXml.new()
xml.LoadXmlFile("c:/temp/itunes.xml")

# Search for this node: <key>Tracks</key>
tracksKey = xml.SearchForContent(xml,"key","Tracks")

# Assuming it's found, the <dict> node is the next sibling
dict = tracksKey.NextSibling()

# Loop over the <dict> child nodes...
n = dict.NumChildrenHavingTag("dict")
for i in 0..(n-1)
        trackRec =
dict.GetNthChildWithTag("dict",i)
        print
"Name: " +
trackRec.GetChildExact("key","Name").NextSibling().content
+ "\n"
        print
"Artist: " +
trackRec.GetChildExact("key","Artist").NextSibling().content
+ "\n"
        print
"Time: " + trackRec.GetChildExact("key","Total
Time").NextSibling().content + "\n"
end


-Matt




At 08:10 PM 11/6/2006, you wrote:

Assuming I go with the Ruby pull parser, how do I use this in my code.
I see from the link the code sample, but I have no idea how to throw
that into my code and make it work. Any suggestions.

Thanks for the discussion so far.

PS: idiot (slaps head). Yes it was 5-6meg not gig!





--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.28/518 - Release Date: 11/4/2006
--=====================_-1915831656==.ALT-- --=======AVGMAIL-454FFACB370E======= Content-Type: text/plain; x-avg=cert; charset=us-ascii; x-avg-checked=avg-ok-1C9D31A Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Description: "AVG certification" No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.13.28/518 - Release Date: 11/4/2006 --=======AVGMAIL-454FFACB370E=======--