module JSON::LD::API::REXML

REXML implementation of an XML parser.

@see www.germane-software.com/software/rexml/

Public Class Methods

library() click to toggle source

Returns the name of the underlying XML library.

@return [Symbol]

# File lib/json/ld/html/rexml.rb, line 14
def self.library
  :rexml
end

Public Instance Methods

initialize_html(input, options = {})
initialize_html_rexml(input, options = {}) click to toggle source

Initializes the underlying XML library.

@param [Hash{Symbol => Object}] options @return [NodeProxy] of document root

# File lib/json/ld/html/rexml.rb, line 172
def initialize_html_rexml(input, options = {})
  require 'rexml/document' unless defined?(::REXML)
  doc = case input
  when ::REXML::Document
    input
  else
    # Only parse as XML, no HTML mode
    ::REXML::Document.new(input.respond_to?(:read) ? input.read : input.to_s)
  end

  NodeProxy.new(doc.root) if doc && doc.root
end
Also aliased as: initialize_html