You can have a look at https://github.com/tedsteiner/OpenStreetMap.jl/blob/master/src/parseMap.jl#L208-L217 for an example. Hope it helps!
On Tuesday, 5 January 2016 11:54:37 UTC-5, Brandon Booth wrote: > > I considered that, but the xp_streaming_parsefile function is undefined > and I didn't see any mention of it in the source documents. If anyone knows > how to use the streaming parse, I'd be happy to give it a shot. > > > On Tuesday, January 5, 2016 at 10:51:22 AM UTC-5, Kenta Sato wrote: >> >> I've never tried, but you may be able to use streaming XML parsing of the >> LibExpat.jl package to parse such a large XML file. See >> https://github.com/amitmurthy/LibExpat.jl#streaming-xml-parsing. >> >> On Tuesday, January 5, 2016 at 11:55:52 PM UTC+9, Brandon Booth wrote: >>> >>> I'm trying to parse a series of XML files and write selected values to >>> an SQLite database. My code works on smaller files, but crashes when I get >>> to anything above about 1 GB. >>> >>> I'm using Atom with the Hydrogen plugin on Julia 0.4.2. >>> >>> Any suggestions on what is going wrong or alternative approaches? >>> >>> Thanks. >>> >>> Brandon >>> >>> >>> using LightXML >>> >>> >>> function iparse(file) f = open(file) n = countlines(f) vals = >>> Array(ASCIIString,n,3) seekstart(f) c = 1 while !eof(f) try st = >>> parse_string(readline(f)) r = root(st) l1 = >>> get_elements_by_tagname(r, "firstlevel) >>> >>> l2 = find_element(l1[1], "secondlevel") >>> >>> vals[c,1] = content(find_element(l2, "thirdlevel1") >>> >>> vals[c,2] = content(find_element(l2, "thirdlevel2") >>> >>> vals[c,1] = content(find_element(l2, "thirdlevel3") c += 1 >>> catch nothing end end return vals close(f)end >>> >>>
