Module: RDF::RDFXML::Reader::REXML
- Defined in:
- 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) ⇒ void
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 'lib/rdf/rdfxml/reader/rexml.rb', line 14 def self.library :rexml end |
Instance Method Details
#doc_errors ⇒ Object
Document errors
278 279 280 |
# File 'lib/rdf/rdfxml/reader/rexml.rb', line 278 def doc_errors [] end |
#initialize_xml(input, **options) ⇒ void
This method returns an undefined value.
Initializes the underlying XML library.
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/rdf/rdfxml/reader/rexml.rb', line 248 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 |