module Oga
line 3 “lib/oga/css/lexer.rl”
line 3 “lib/oga/xpath/lexer.rl”
Constants
- VERSION
Public Class Methods
parse_html(html, options = {})
click to toggle source
Parses the given HTML
document.
@example
document = Oga.parse_html('<html>...</html>')
@see [Oga::XML::Lexer#initialize]
@return [Oga::XML::Document]
# File lib/oga/oga.rb, line 22 def self.parse_html(html, options = {}) HTML::Parser.new(html, options).parse end
parse_xml(xml, options = {})
click to toggle source
Parses the given XML
document.
@example
document = Oga.parse_xml('<root>Hello</root>')
@see [Oga::XML::Lexer#initialize]
@return [Oga::XML::Document]
# File lib/oga/oga.rb, line 10 def self.parse_xml(xml, options = {}) XML::Parser.new(xml, options).parse end
sax_parse_html(handler, html, options = {})
click to toggle source
Parses the given HTML
document using the SAX parser.
@example
handler = SomeSaxHandler.new Oga.sax_parse_html(handler, '<script>foo()</script>')
@see [Oga::XML::SaxParser#initialize]
# File lib/oga/oga.rb, line 46 def self.sax_parse_html(handler, html, options = {}) HTML::SaxParser.new(handler, html, options).parse end
sax_parse_xml(handler, xml, options = {})
click to toggle source
Parses the given XML
document using the SAX parser.
@example
handler = SomeSaxHandler.new Oga.sax_parse_html(handler, '<root>Hello</root>')
@see [Oga::XML::SaxParser#initialize]
# File lib/oga/oga.rb, line 34 def self.sax_parse_xml(handler, xml, options = {}) XML::SaxParser.new(handler, xml, options).parse end