class LibXML::XML::SaxParser
Public Class Methods
XML::SaxParser.file(path) → XML::SaxParser
click to toggle source
Creates a new parser by parsing the specified file or uri.
# File lib/libxml/sax_parser.rb, line 9 def self.file(path) context = XML::Parser::Context.file(path) self.new(context) end
XML::SaxParser.io(io) → XML::SaxParser
click to toggle source
XML::SaxParser.io(io, :encoding => XML::Encoding::UTF_8) → XML::SaxParser
Creates a new reader by parsing the specified io object.
Parameters:
encoding - The document encoding, defaults to nil. Valid values are the encoding constants defined on XML::Encoding.
# File lib/libxml/sax_parser.rb, line 24 def self.io(io, options = {}) context = XML::Parser::Context.io(io) context.encoding = options[:encoding] if options[:encoding] self.new(context) end
XML::SaxParser.string(string)
click to toggle source
Creates a new parser by parsing the specified string.
# File lib/libxml/sax_parser.rb, line 34 def self.string(string) context = XML::Parser::Context.string(string) self.new(context) end