Module: RDF::RDFXML::Reader::REXML
- Defined in:
- vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/rexml.rb
Overview
REXML implementation of an XML parser.
Defined Under Namespace
Classes: Namespace, NodeProxy, NodeSetProxy
Class Method Summary collapse
-
.library ⇒ Symbol
Returns the name of the underlying XML library.
Instance Method Summary collapse
-
#doc_errors ⇒ Object
Document errors.
-
#initialize_xml(input, **options)
Initializes the underlying XML library.
-
#root ⇒ Object
Return proxy for document root.
Class Method Details
.library ⇒ Symbol
Returns the name of the underlying XML library.
14 15 16 |
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/rexml.rb', line 14 def self.library :rexml end |
Instance Method Details
#doc_errors ⇒ Object
Document errors
306 307 308 |
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/rexml.rb', line 306 def doc_errors [] end |
#initialize_xml(input, **options)
This method returns an undefined value.
Initializes the underlying XML library.
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/rdf-rdfxml-14ee5432437b/lib/rdf/rdfxml/reader/rexml.rb', line 276 def initialize_xml(input, **) require 'rexml/document' unless defined?(::REXML) @doc = case input when ::REXML::Document input else # Try to detect charset from input [:encoding] ||= input.charset if input.respond_to?(:charset) # Otherwise, default is utf-8 [:encoding] ||= 'utf-8' # Set xml:base for the document element, if defined @base_uri = base_uri ? base_uri.to_s : nil # Only parse as XML, no HTML mode ::REXML::Document.new(input.respond_to?(:read) ? input.read : input.to_s) end end |