# XML::SaxParser

**URL:** <https://www.ruby-forum.com/t/xml-saxparser/216373>\
**Category:** IT\
**Created:** [February 2, 2012, 7:23pm UTC](https://www.ruby-forum.com/t/xml-saxparser/216373 "2012-02-02T19:23:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 2, 2012, 7:23pm UTC](https://www.ruby-forum.com/t/xml-saxparser/216373/1 "2012-02-02T19:23:57Z")

</div>

Buonasera  
a questo link

> **[Fast XML parsing with Ruby](https://ioncannon.net/programming/643/fast-xml-parsing-with-ruby/)**
>
> One of the first things I needed to do while building the GeeQE iPhone application was process the CC data dump from Stack Overflow. The dump contains XML files representing tables from Stack Overflow with the largest file being posts.xml weighing in...

ho trovato questo  
##########################  
require ‘rubygems’  
require ‘libxml’

include LibXML

class PostCallbacks  
include XML::SaxParser::Callbacks

def on\_start\_element(element, attributes)  
if element == ‘row’  
# Process row of data here  
end  
end  
end

parser = XML::SaxParser.file(“posts.xml”)  
parser.callbacks = PostCallbacks.new  
parser.parse  
#####################################

potete farmi un esempio chiaro di che cosa mettere al posto di

# Process row of data here

per ottenere i valori tra i tag che su google non ho trovato un  
accidente di esempio ??

grazie mille

---

<div class="post-metadata">

**Author:** ![mariarosaria](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e19b73/32.png) [@mariarosaria](https://www.ruby-forum.com/u/mariarosaria)\
**Post date:** [February 2, 2012, 9:33pm UTC](https://www.ruby-forum.com/t/xml-saxparser/216373/2 "2012-02-02T21:33:19Z")

</div>

Risale a qualche anno fa, non so se pu esserti d’aiuto:  
[http://lucaguidi.com/post/2403439844/ruby-xml-parsing-with-sax](http://lucaguidi.com/post/2403439844/ruby-xml-parsing-with-sax)

PS: mi spiace per la mancata formattazione del codice, prima o poi  
sistemer la cosa.

Luca
