Devon,

Thanks for your comments.

I elected to see if I could master the xml approach and found it was
pretty easy in this case. The code script below seems to strip the
data from the file. I used j602 because  I could not find xml/sax in
the beta jal.

require 'xml/sax format'

saxclass 'pfreecell'


noba=: -.&' '
nob=: -.&LF
startDocument=: 3 : 0
  S=: ''
  Z=: i.0 2
)
endDocument=: 3 : 'Z'

startElement=: 4 : 0
  S=: S,<y
)

endElement=: 3 : 0
  S=: }:S
)

characters=: 3 : 0
  s2=. _2{.S
  if. s2 -: ;:'dict key' do. Z=:Z,y
  elseif. (1<#y) *. #noba y do. Z=:Z,  y
end.
)

Note 'demo'
load 'files'
indata=: fread jpath '~user/xmltest'
data =: process_pfreecell_ indata
)

indata =: 0 : 0
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.
com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
        <dict>
                <key>date</key>
                <date>2010-07-25T02:55:34Z</date>
                <key>duration</key>
                <date>2001-01-01T00:29:10Z</date>
                <key>gameNumber</key>
                <real>94163764</real>
                <key>moves</key>
                <integer>23</integer>
                <key>result</key>
                <string>Loss</string>
        </dict>
        <dict>
                <key>date</key>
                <date>2010-07-05T19:46:01Z</date>
                <key>duration</key>
                <date>2001-01-01T00:08:44Z</date>
                <key>gameNumber</key>
                <real>192061342</real>
                <key>moves</key>
                <integer>108</integer>
                <key>result</key>
                <string>Win</string>
        </dict>
</array>
</plist>
)


-- 
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to