Parsing Large XML files w/ Ruby & Nokogiri

后端 未结 5 1550
眼角桃花
眼角桃花 2021-01-02 07:30

I have a large XML file (about 10K rows) I need to parse regularly that is in this format:


    10000         


        
5条回答
  •  天命终不由人
    2021-01-02 08:31

    Check out Greg Weber's version of Paul Dix's sax-machine gem: http://blog.gregweber.info/posts/2011-06-03-high-performance-rb-part1

    Parsing large file with SaxMachine seems to be loading the whole file into memory

    sax-machine makes the code much much simpler; Greg's variant makes it stream.

提交回复
热议问题