HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/gems/default/doc/nokogiri-1.12.5-x86_64-linux/ri/Nokogiri/XML/SAX/cdesc-SAX.ri
U:RDoc::NormalModule[iI"SAX:ETI"Nokogiri::XML::SAX;T0o:RDoc::Markup::Document:@parts[
o;;[:
@fileI"ext/nokogiri/nokogiri.c;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[I"dSAX Parsers are event driven parsers. Nokogiri provides two different event based parsers when ;TI"Qdealing with XML. If you want to do SAX style parsing using HTML, check out ;TI"Nokogiri::HTML4::SAX.;To:RDoc::Markup::BlankLineo;;[I"bThe basic way a SAX style parser works is by creating a parser, telling the parser about the ;TI"devents we're interested in, then giving the parser some XML to process. The parser will notify ;TI"Iyou when it encounters events you said you would like to know about.;T@o;;[I"aTo register for events, you simply subclass Nokogiri::XML::SAX::Document, and implement the ;TI"3methods for which you would like notification.;T@o;;[I"_For example, if I want to be notified when a document ends, and when an element starts, I ;TI"#would write a class like this:;T@o:RDoc::Markup::Verbatim;[I"5class MyDocument < Nokogiri::XML::SAX::Document
;TI"  def end_document
;TI"'    puts "the document has ended"
;TI"  end
;TI"
;TI"/  def start_element name, attributes = []
;TI"     puts "#{name} started"
;TI"  end
;TI"	end
;T:@format0o;;[I"[Then I would instantiate a SAX parser with this document, and feed the parser some XML;T@o;
;[
I"# Create a new parser
;TI"=parser = Nokogiri::XML::SAX::Parser.new(MyDocument.new)
;TI"
;TI" # Feed the parser some XML
;TI"&parser.parse(File.open(ARGV[0]))
;T;0o;;[I"cNow my document handler will be called when each node starts, and when then document ends. To ;TI"Ysee what kinds of events are available, take a look at Nokogiri::XML::SAX::Document.;T@o;;[	I"aTwo SAX parsers for XML are available, a parser that reads from a string or IO object as it ;TI"`feels necessary, and a parser that lets you spoon feed it XML. If you want to let Nokogiri ;TI"ddeal with reading your XML, use the Nokogiri::XML::SAX::Parser. If you want to have fine grain ;TI"Hcontrol over the XML input, use the Nokogiri::XML::SAX::PushParser.;T;	I"%lib/nokogiri/xml/sax/document.rb;T;
0o;;[;	I"#lib/nokogiri/xml/sax/parser.rb;T;
0o;;[;	I"+lib/nokogiri/xml/sax/parser_context.rb;T;
0o;;[;	I"(lib/nokogiri/xml/sax/push_parser.rb;T;
0;	0;
0[[[[[I"
class;T[[:public[[:protected[[:private[[I"
instance;T[[;[[;[[;[[[U:RDoc::Context::Section[i0o;;[;	0;
0[
@
@B@E@H@KI"Nokogiri::XML;TcRDoc::NormalModule