Nokogiri::HTML::SAX::PushParser

class Nokogiri::HTML::SAX::PushParser

Parent:
cNokogiriXmlSaxPushParser

Attributes

document[RW]

The Nokogiri::HTML::SAX::Document on which the PushParser will be operating

Public Class Methods

new(doc = HTML::SAX::Document.new, file_name = nil, encoding = 'UTF-8') Show source
# File lib/nokogiri/html/sax/push_parser.rb, line 10
def initialize(doc = HTML::SAX::Document.new, file_name = nil, encoding = 'UTF-8')
  @document = doc
  @encoding = encoding
  @sax_parser = HTML::SAX::Parser.new(doc, @encoding)

  ## Create our push parser context
  initialize_native(@sax_parser, file_name, encoding)
end

Public Instance Methods

<<(chunk, last_chunk = false)
Alias for: write
finish() Show source

Finish the parsing. This method is only necessary for Nokogiri::HTML::SAX::Document#end_document to be called.

# File lib/nokogiri/html/sax/push_parser.rb, line 30
def finish
  write '', true
end
write(chunk, last_chunk = false) Show source

Write a chunk of HTML to the PushParser. Any callback methods that can be called will be called immediately.

# File lib/nokogiri/html/sax/push_parser.rb, line 22
def write chunk, last_chunk = false
  native_write(chunk, last_chunk)
end
Also aliased as: <<

© 2008–2016 Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo
Patrick Mahoney, Yoko Harada, Akinori Musha, John Shahid
Licensed under the MIT License.

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部