Parent

LibXML::XML::Parser

Public Class Methods

document(document) → XML::Parser click to toggle source

Creates a new parser for the specified document.

Parameters:

 document - A preparsed document.
    # File lib/libxml/parser.rb, line 14
14:       def self.document(doc)
15:         context = XML::Parser::Context.document(doc)
16:         self.new(context)
17:       end
file(path, :encoding => XML::Encoding::UTF_8, :options => XML::Parser::Options::NOENT) → XML::Parser click to toggle source

Creates a new parser for 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::Parser::Options.  Mutliple options can be combined
           by using Bitwise OR (|).
    # File lib/libxml/parser.rb, line 34
34:       def self.file(path, options = {})
35:         context = XML::Parser::Context.file(path)
36:         context.encoding = options[:encoding] if options[:encoding]
37:         context.options = options[:options] if options[:options]
38:         self.new(context)
39:       end
org") → XML::Parser click to toggle source

Creates a new parser for 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::Parser::Options.  Mutliple options can be combined
           by using Bitwise OR (|).
    # File lib/libxml/parser.rb, line 58
58:       def self.io(io, options = {})
59:         context = XML::Parser::Context.io(io)
60:         context.base_uri = options[:base_uri] if options[:base_uri]
61:         context.encoding = options[:encoding] if options[:encoding]
62:         context.options = options[:options] if options[:options]
63:         self.new(context)
64:       end
register_error_handler(proc) click to toggle source
    # File lib/libxml/parser.rb, line 91
91:       def self.register_error_handler(proc)
92:         warn('Parser.register_error_handler is deprecated.  Use Error.set_handler instead')
93:         if proc.nil?
94:           Error.reset_handler
95:         else
96:           Error.set_handler(&proc)
97:         end
98:       end
org") → XML::Parser click to toggle source

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::Parser::Options.  Mutliple options can be combined
           by using Bitwise OR (|).
    # File lib/libxml/parser.rb, line 83
83:       def self.string(string, options = {})
84:         context = XML::Parser::Context.string(string)
85:         context.base_uri = options[:base_uri] if options[:base_uri]
86:         context.encoding = options[:encoding] if options[:encoding]
87:         context.options = options[:options] if options[:options]
88:         self.new(context)
89:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.