Module: JSON::LD::API::REXML
- Defined in:
- lib/json/ld/html/rexml.rb
Overview
REXML implementation of an XML parser.
Defined Under Namespace
Classes: NodeProxy, NodeSetProxy
Class Method Summary collapse
-
.library ⇒ Symbol
Returns the name of the underlying XML library.
Instance Method Summary collapse
-
#initialize_html_rexml(input, _options = {}) ⇒ NodeProxy
(also: #initialize_html)
Initializes the underlying XML library.
Class Method Details
.library ⇒ Symbol
Returns the name of the underlying XML library.
17 18 19 |
# File 'lib/json/ld/html/rexml.rb', line 17 def self.library :rexml end |
Instance Method Details
#initialize_html_rexml(input, _options = {}) ⇒ NodeProxy Also known as: initialize_html
Initializes the underlying XML library.
175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/json/ld/html/rexml.rb', line 175 def initialize_html_rexml(input, = {}) 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&.root end |