Sha256: 12187e2635fbe4fe603e2eced8b503d0d30591a069f91500ea197c67ee33d67d

Contents?: true

Size: 1012 Bytes

Versions: 16

Compression:

Stored size: 1012 Bytes

Contents

# :stopdoc:
module Nokogiri
  module HTML
    module SAX
      class ParserContext < Nokogiri::XML::SAX::ParserContext
        attr_accessor :cstruct

        def self.file filename, encoding
          ctx = LibXML.htmlCreateFileParserCtxt filename, encoding
          pc = allocate
          pc.cstruct = LibXML::XmlParserContext.new ctx
          pc
        end

        def self.memory data, encoding
          raise ArgumentError unless data
          raise "data cannot be empty" unless data.length > 0

          ctx = LibXML.htmlCreateMemoryParserCtxt data, data.length
          pc = allocate
          pc.cstruct = LibXML::XmlParserContext.new ctx
          if encoding
            enc = LibXML.xmlParseCharEncoding(encoding)
            if enc != LibXML::XML_CHAR_ENCODING_ERROR
              LibXML.xmlSwitchEncoding(ctx, enc)
            end
          end
          pc
        end

        def parse_with sax_handler, type = :html
          super
        end
      end
    end
  end
end
# :startdoc:

Version data entries

16 entries across 16 versions & 6 rubygems

Version Path
rubyjedi-nokogiri_java-1.4.0.20100513161003-java lib/nokogiri/ffi/html/sax/parser_context.rb
jwagener-nokogiri-1.4.1 lib/nokogiri/ffi/html/sax/parser_context.rb
revo-nokogiri-1.4.1-java lib/nokogiri/ffi/html/sax/parser_context.rb
revo-nokogiri-1.4.0.3-java lib/nokogiri/ffi/html/sax/parser_context.rb
revo-nokogiri-1.4.0-java lib/nokogiri/ffi/html/sax/parser_context.rb
revo-nokogiri-1.4.0.20100202165440-java lib/nokogiri/ffi/html/sax/parser_context.rb
nokogiri-1.4.1-x86-mswin32 lib/nokogiri/ffi/html/sax/parser_context.rb
nokogiri-1.4.1-x86-mingw32 lib/nokogiri/ffi/html/sax/parser_context.rb
nokogiri-1.4.1-java lib/nokogiri/ffi/html/sax/parser_context.rb
nokogiri-1.4.1 lib/nokogiri/ffi/html/sax/parser_context.rb
superfeedr-nokogiri-1.4.0.20091116183308 lib/nokogiri/ffi/html/sax/parser_context.rb
caring-nokogiri-1.4.1.pre1 lib/nokogiri/ffi/html/sax/parser_context.rb
nokogiri-1.4.0-java lib/nokogiri/ffi/html/sax/parser_context.rb
nokogiri-1.4.0-x86-mswin32 lib/nokogiri/ffi/html/sax/parser_context.rb
nokogiri-1.4.0-x86-mingw32 lib/nokogiri/ffi/html/sax/parser_context.rb
nokogiri-1.4.0 lib/nokogiri/ffi/html/sax/parser_context.rb