The program below reads and searches an iTunes xml file and returns the
names of the playlists.
It works fine as long as the XML file is 200K or less. Anything bigger
gives an error:
java.lang.OutOfMemoryError
The error is caused by the XmlSearch function on line 4.
By contrast, I can cfexecute a Perl program that line-by-line reads a
84,00 line / 3.8 Meg xml file, extract all the playlists and their
songs, export them, and write to external files -- in 2-3 seconds.
The CF-only program runs for about 6-7 seconds before it throws the
error.
I really would prefer an all CF solution, but it does not appear that
the XmlSearch function is robust enough to handle a reasonable-size xml
file.
I wonder, Am I doing something wrong or are people not using XmlSearch,
or just using it on small xml files.
TIA
Dick
Here's the cf program.
1 <!--- Convert file to XML document object --->
2 <cffile action="" file="/Users/Richard/Music/iTunes/iTunes Music
LibraryCopy1.xml" variable="myxml">
3 <cfset mydoc = XmlParse(myxml)>
4 <cfset playlists = XmlSearch(mydoc,
"/plist/dict/array/dict/string[1]")>
5 <cfdump var="#Playlists#">
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- RE: Out of Memory Error Transforming large XM... Barney Boisvert
- Re: Out of Memory Error Transforming larg... Dick Applebaum
- RE: Out of Memory Error Transforming... Barney Boisvert
- Re: Out of Memory Error Transfor... Dick Applebaum
- Re: Out of Memory Error Transfor... Dick Applebaum
- Resolved: Out of Memory Error Tr... Dick Applebaum
- java.lang.OutOfMemoryError Dick Applebaum
- RE: Out of Memory Error Transforming large XML file. Calvin Ward
- Re: Out of Memory Error Transforming large XML file. Dick Applebaum
- Ordering/Sorting CFFTP Results with "listDir... Greg Landers
- RE: Out of Memory Error Transforming large XML fi... Dick Applebaum
- RE: Out of Memory Error Transforming large XML file. Matthew Walker