Module: Wayfarer::Parsers::XMLParser

Defined in:
lib/wayfarer/parsers/xml_parser.rb

Overview

A wrapper class for parsing HTML/XML.

Class Method Summary collapse

Class Method Details

.parse_html(html_str) ⇒ Nokogiri::HTML::Document

Parses a HTML string.

Parameters:

  • html_str (String)

    the HTML string to parse.

Returns:

  • (Nokogiri::HTML::Document)

22
23
24
# File 'lib/wayfarer/parsers/xml_parser.rb', line 22

def parse_html(html_str)
  Nokogiri::HTML(html_str)
end

.parse_xml(xml_str) ⇒ Nokogiri::XML::Document

Parses an XML string.

Parameters:

  • xml_str (String)

    the XML string to parse.

Returns:

  • (Nokogiri::XML::Document)

15
16
17
# File 'lib/wayfarer/parsers/xml_parser.rb', line 15

def parse_xml(xml_str)
  Nokogiri::XML(xml_str)
end