Sha256: e231647fdb3ff0efeb83edd3c45424e698f790c14b0c2039c0fc0e3d4376e68f

Contents?: true

Size: 1.31 KB

Versions: 43

Compression:

Stored size: 1.31 KB

Contents

module Nokogiri
  module XML
    module SAX
      class PushParser

        attr_accessor :cstruct # :nodoc:

        def options
          cstruct[:options]
        end

        def options=(user_options)
          if LibXML.xmlCtxtUseOptions(cstruct, user_options) != 0
            raise RuntimeError, "Cannot set XML parser context options"
          end
          nil
        end

        private

        def native_write(chunk, last_chunk) # :nodoc:
          size = 0
          unless chunk.nil?
            chunk = chunk.to_s
            size = chunk.length
          end

          if LibXML.xmlParseChunk(cstruct, chunk, size, last_chunk ? 1 : 0) != 0
            if (cstruct[:options] & XML::ParseOptions::RECOVER) == 0
              error = LibXML.xmlCtxtGetLastError(cstruct)
              raise Nokogiri::XML::SyntaxError.wrap(error)
            end
          end

          self
        end

        def initialize_native(sax, filename) # :nodoc:
          filename = filename.to_s unless filename.nil?
          ctx_ptr = LibXML.xmlCreatePushParserCtxt(
            sax.cstruct, nil, nil, 0, filename
            )
          raise(RuntimeError, "Could not create a parser context") if ctx_ptr.null?
          self.cstruct = LibXML::XmlSaxPushParserContext.new(ctx_ptr) ;
          self
        end

      end
    end
  end
end

Version data entries

43 entries across 43 versions & 6 rubygems

Version Path
domo-0.0.4 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.4.4/lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.7-java lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.7-x86-mingw32 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.7-x86-mswin32-60 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.7 lib/nokogiri/ffi/xml/sax/push_parser.rb
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/nokogiri-1.4.6/lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.6 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.6-java lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.6-x86-mingw32 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.6-x86-mswin32-60 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.5-java lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.5 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.5-x86-mswin32-60 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.5-x86-mingw32 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.4.2-java lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.4.1-x86-mswin32 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.4.1-x86-mingw32 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.4-x86-mswin32 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.4-x86-mingw32 lib/nokogiri/ffi/xml/sax/push_parser.rb
nokogiri-1.4.4-java lib/nokogiri/ffi/xml/sax/push_parser.rb