Parent

Methods

LibXML::XML::HTMLParser

Public Class Methods

XML::HTMLParser.file(path) → XML::HTMLParser click to toggle source
XML::HTMLParser.file(path, :encoding => XML::Encoding::UTF_8,
:options => XML::HTMLParser::Options::NOENT) → XML::HTMLParser

Creates a new parser by parsing the specified file or uri.

You may provide an optional hash table to control how the parsing is performed. Valid options are:

encoding - The document encoding, defaults to nil. Valid values
           are the encoding constants defined on XML::Encoding.
options - Parser options.  Valid values are the constants defined on
          XML::HTMLParser::Options.  Mutliple options can be combined
          by using Bitwise OR (|).
# File lib/libxml/html_parser.rb, line 20
def self.file(path, options = {})
  context = XML::HTMLParser::Context.file(path)
  context.encoding = options[:encoding] if options[:encoding]
  context.options = options[:options] if options[:options]
  self.new(context)
end
XML::HTMLParser.io(io) → XML::HTMLParser click to toggle source
XML::HTMLParser.io(io, :encoding => XML::Encoding::UTF_8,
:options => XML::HTMLParser::Options::NOENT
:base_uri="http://libxml.org") → XML::HTMLParser

Creates a new reader by parsing the specified io object.

Parameters:

io - io object that contains the xml to parser
base_uri - The base url for the parsed document.
encoding - The document encoding, defaults to nil. Valid values
           are the encoding constants defined on XML::Encoding.
options - Parser options.  Valid values are the constants defined on
          XML::HTMLParser::Options.  Mutliple options can be combined
          by using Bitwise OR (|).
# File lib/libxml/html_parser.rb, line 44
def self.io(io, options = {})
  context = XML::HTMLParser::Context.io(io)
  context.base_uri = options[:base_uri] if options[:base_uri]
  context.encoding = options[:encoding] if options[:encoding]
  context.options = options[:options] if options[:options]
  self.new(context)
end
XML::HTMLParser.string(string) click to toggle source
XML::HTMLParser.string(string, :encoding => XML::Encoding::UTF_8,
:options => XML::HTMLParser::Options::NOENT
:base_uri="http://libxml.org") → XML::HTMLParser

Creates a new parser by parsing the specified string.

You may provide an optional hash table to control how the parsing is performed. Valid options are:

base_uri - The base url for the parsed document.
encoding - The document encoding, defaults to nil. Valid values
           are the encoding constants defined on XML::Encoding.
options - Parser options.  Valid values are the constants defined on
          XML::HTMLParser::Options.  Mutliple options can be combined
          by using Bitwise OR (|).
# File lib/libxml/html_parser.rb, line 69
def self.string(string, options = {})
  context = XML::HTMLParser::Context.string(string)
  context.base_uri = options[:base_uri] if options[:base_uri]
  context.encoding = options[:encoding] if options[:encoding]
  context.options = options[:options] if options[:options]
  self.new(context)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.